79 lines
1.4 KiB
Plaintext
79 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: "museums",
|
|
mappings: {
|
|
properties: {
|
|
location: {
|
|
type: "geo_point",
|
|
},
|
|
name: {
|
|
type: "keyword",
|
|
},
|
|
price: {
|
|
type: "long",
|
|
},
|
|
included: {
|
|
type: "boolean",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.bulk({
|
|
index: "museums",
|
|
refresh: "true",
|
|
operations: [
|
|
{
|
|
index: {
|
|
_id: "1",
|
|
},
|
|
},
|
|
{
|
|
location: "POINT (4.912350 52.374081)",
|
|
name: "NEMO Science Museum",
|
|
price: 1750,
|
|
included: true,
|
|
},
|
|
{
|
|
index: {
|
|
_id: "2",
|
|
},
|
|
},
|
|
{
|
|
location: "POINT (4.901618 52.369219)",
|
|
name: "Museum Het Rembrandthuis",
|
|
price: 1500,
|
|
included: false,
|
|
},
|
|
{
|
|
index: {
|
|
_id: "3",
|
|
},
|
|
},
|
|
{
|
|
location: "POINT (4.914722 52.371667)",
|
|
name: "Nederlands Scheepvaartmuseum",
|
|
price: 1650,
|
|
included: true,
|
|
},
|
|
{
|
|
index: {
|
|
_id: "4",
|
|
},
|
|
},
|
|
{
|
|
location: "POINT (4.914722 52.371667)",
|
|
name: "Amsterdam Centre for Architecture",
|
|
price: 0,
|
|
included: true,
|
|
},
|
|
],
|
|
});
|
|
console.log(response1);
|
|
----
|