Files
elasticsearch-js/docs/doc_examples/229b83cbcd8efa1b0288a728a2abacb4.asciidoc
2024-07-29 17:10:05 -05:00

74 lines
1.4 KiB
Plaintext

// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.indices.create({
index: "my-index-000001",
mappings: {
properties: {
location: {
type: "point",
},
},
},
});
console.log(response);
const response1 = await client.index({
index: "my-index-000001",
id: 1,
document: {
text: "Point as an object using GeoJSON format",
location: {
type: "Point",
coordinates: [-71.34, 41.12],
},
},
});
console.log(response1);
const response2 = await client.index({
index: "my-index-000001",
id: 2,
document: {
text: "Point as a WKT POINT primitive",
location: "POINT (-71.34 41.12)",
},
});
console.log(response2);
const response3 = await client.index({
index: "my-index-000001",
id: 3,
document: {
text: "Point as an object with 'x' and 'y' keys",
location: {
x: -71.34,
y: 41.12,
},
},
});
console.log(response3);
const response4 = await client.index({
index: "my-index-000001",
id: 4,
document: {
text: "Point as an array",
location: [-71.34, 41.12],
},
});
console.log(response4);
const response5 = await client.index({
index: "my-index-000001",
id: 5,
document: {
text: "Point as a string",
location: "-71.34,41.12",
},
});
console.log(response5);
----