74 lines
1.4 KiB
Plaintext
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);
|
|
----
|