Added/updated snippets for docs (#2318)
This commit is contained in:
72
docs/doc_examples/ad57ccba0a060da4f5313692fa26a235.asciidoc
Normal file
72
docs/doc_examples/ad57ccba0a060da4f5313692fa26a235.asciidoc
Normal file
@ -0,0 +1,72 @@
|
||||
// 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_nanos",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log(response);
|
||||
|
||||
const response1 = await client.bulk({
|
||||
index: "my-index-000001",
|
||||
refresh: "true",
|
||||
operations: [
|
||||
{
|
||||
index: {
|
||||
_id: "1",
|
||||
},
|
||||
},
|
||||
{
|
||||
date: "2015-01-01",
|
||||
},
|
||||
{
|
||||
index: {
|
||||
_id: "2",
|
||||
},
|
||||
},
|
||||
{
|
||||
date: "2015-01-01T12:10:30.123456789Z",
|
||||
},
|
||||
{
|
||||
index: {
|
||||
_id: "3",
|
||||
},
|
||||
},
|
||||
{
|
||||
date: 1420070400000,
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response1);
|
||||
|
||||
const response2 = await client.search({
|
||||
index: "my-index-000001",
|
||||
sort: {
|
||||
date: "asc",
|
||||
},
|
||||
runtime_mappings: {
|
||||
date_has_nanos: {
|
||||
type: "boolean",
|
||||
script: "emit(doc['date'].value.nano != 0)",
|
||||
},
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
field: "date",
|
||||
format: "strict_date_optional_time_nanos",
|
||||
},
|
||||
{
|
||||
field: "date_has_nanos",
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log(response2);
|
||||
----
|
||||
Reference in New Issue
Block a user