55 lines
998 B
Plaintext
55 lines
998 B
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",
|
|
mappings: {
|
|
dynamic_templates: [
|
|
{
|
|
geo_point: {
|
|
mapping: {
|
|
type: "geo_point",
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.bulk({
|
|
operations: [
|
|
{
|
|
index: {
|
|
_index: "my_index",
|
|
_id: "1",
|
|
dynamic_templates: {
|
|
work_location: "geo_point",
|
|
},
|
|
},
|
|
},
|
|
{
|
|
field: "value1",
|
|
work_location: "41.12,-71.34",
|
|
raw_location: "41.12,-71.34",
|
|
},
|
|
{
|
|
create: {
|
|
_index: "my_index",
|
|
_id: "2",
|
|
dynamic_templates: {
|
|
home_location: "geo_point",
|
|
},
|
|
},
|
|
},
|
|
{
|
|
field: "value2",
|
|
home_location: "41.12,-71.34",
|
|
},
|
|
],
|
|
});
|
|
console.log(response1);
|
|
----
|