58 lines
908 B
Plaintext
58 lines
908 B
Plaintext
// This file is autogenerated, DO NOT EDIT
|
|
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
|
|
|
[source, js]
|
|
----
|
|
const response0 = await client.indices.create({
|
|
index: 'my_index',
|
|
body: {
|
|
mappings: {
|
|
properties: {
|
|
date: {
|
|
type: 'date'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
console.log(response0)
|
|
|
|
const response1 = await client.index({
|
|
index: 'my_index',
|
|
id: '1',
|
|
body: {
|
|
date: '2015-01-01'
|
|
}
|
|
})
|
|
console.log(response1)
|
|
|
|
const response2 = await client.index({
|
|
index: 'my_index',
|
|
id: '2',
|
|
body: {
|
|
date: '2015-01-01T12:10:30Z'
|
|
}
|
|
})
|
|
console.log(response2)
|
|
|
|
const response3 = await client.index({
|
|
index: 'my_index',
|
|
id: '3',
|
|
body: {
|
|
date: 1420070400001
|
|
}
|
|
})
|
|
console.log(response3)
|
|
|
|
const response4 = await client.search({
|
|
index: 'my_index',
|
|
body: {
|
|
sort: {
|
|
date: 'asc'
|
|
}
|
|
}
|
|
})
|
|
console.log(response4)
|
|
----
|
|
|