46 lines
733 B
Plaintext
46 lines
733 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-dfs-index",
|
|
settings: {
|
|
number_of_shards: 2,
|
|
number_of_replicas: 1,
|
|
},
|
|
mappings: {
|
|
properties: {
|
|
"my-keyword": {
|
|
type: "keyword",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.bulk({
|
|
index: "my-dfs-index",
|
|
refresh: "true",
|
|
operations: [
|
|
{
|
|
index: {
|
|
_id: "1",
|
|
},
|
|
},
|
|
{
|
|
"my-keyword": "a",
|
|
},
|
|
{
|
|
index: {
|
|
_id: "2",
|
|
},
|
|
},
|
|
{
|
|
"my-keyword": "b",
|
|
},
|
|
],
|
|
});
|
|
console.log(response1);
|
|
----
|