(cherry picked from commit f737290d10)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
40 lines
734 B
Plaintext
40 lines
734 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-000001",
|
|
mappings: {
|
|
properties: {
|
|
date: {
|
|
type: "date",
|
|
format: "strict_date_optional_time||epoch_second",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.index({
|
|
index: "my-index-000001",
|
|
id: "example",
|
|
refresh: "true",
|
|
document: {
|
|
date: 1618321898,
|
|
},
|
|
});
|
|
console.log(response1);
|
|
|
|
const response2 = await client.search({
|
|
index: "my-index-000001",
|
|
fields: [
|
|
{
|
|
field: "date",
|
|
},
|
|
],
|
|
_source: false,
|
|
});
|
|
console.log(response2);
|
|
----
|