57 lines
1.0 KiB
Plaintext
57 lines
1.0 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: {
|
|
user_id: {
|
|
type: "keyword",
|
|
},
|
|
last_updated: {
|
|
type: "date",
|
|
},
|
|
session_data: {
|
|
type: "object",
|
|
enabled: false,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.index({
|
|
index: "my-index-000001",
|
|
id: "session_1",
|
|
document: {
|
|
user_id: "kimchy",
|
|
session_data: {
|
|
arbitrary_object: {
|
|
some_array: [
|
|
"foo",
|
|
"bar",
|
|
{
|
|
baz: 2,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
last_updated: "2015-12-06T18:20:22",
|
|
},
|
|
});
|
|
console.log(response1);
|
|
|
|
const response2 = await client.index({
|
|
index: "my-index-000001",
|
|
id: "session_2",
|
|
document: {
|
|
user_id: "jpountz",
|
|
session_data: "none",
|
|
last_updated: "2015-12-06T18:22:13",
|
|
},
|
|
});
|
|
console.log(response2);
|
|
----
|