162 lines
3.2 KiB
Plaintext
162 lines
3.2 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: "tour",
|
|
mappings: {
|
|
properties: {
|
|
city: {
|
|
type: "keyword",
|
|
time_series_dimension: true,
|
|
},
|
|
category: {
|
|
type: "keyword",
|
|
},
|
|
route: {
|
|
type: "long",
|
|
},
|
|
name: {
|
|
type: "keyword",
|
|
},
|
|
location: {
|
|
type: "geo_point",
|
|
},
|
|
"@timestamp": {
|
|
type: "date",
|
|
},
|
|
},
|
|
},
|
|
settings: {
|
|
index: {
|
|
mode: "time_series",
|
|
routing_path: ["city"],
|
|
time_series: {
|
|
start_time: "2023-01-01T00:00:00Z",
|
|
end_time: "2024-01-01T00:00:00Z",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.bulk({
|
|
index: "tour",
|
|
refresh: "true",
|
|
operations: [
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-02T09:00:00Z",
|
|
route: 0,
|
|
location: "POINT(4.889187 52.373184)",
|
|
city: "Amsterdam",
|
|
category: "Attraction",
|
|
name: "Royal Palace Amsterdam",
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-02T10:00:00Z",
|
|
route: 1,
|
|
location: "POINT(4.885057 52.370159)",
|
|
city: "Amsterdam",
|
|
category: "Attraction",
|
|
name: "The Amsterdam Dungeon",
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-02T13:00:00Z",
|
|
route: 2,
|
|
location: "POINT(4.901618 52.369219)",
|
|
city: "Amsterdam",
|
|
category: "Museum",
|
|
name: "Museum Het Rembrandthuis",
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-02T16:00:00Z",
|
|
route: 3,
|
|
location: "POINT(4.912350 52.374081)",
|
|
city: "Amsterdam",
|
|
category: "Museum",
|
|
name: "NEMO Science Museum",
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-03T12:00:00Z",
|
|
route: 4,
|
|
location: "POINT(4.914722 52.371667)",
|
|
city: "Amsterdam",
|
|
category: "Museum",
|
|
name: "Nederlands Scheepvaartmuseum",
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-04T09:00:00Z",
|
|
route: 5,
|
|
location: "POINT(4.401384 51.220292)",
|
|
city: "Antwerp",
|
|
category: "Attraction",
|
|
name: "Cathedral of Our Lady",
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-04T12:00:00Z",
|
|
route: 6,
|
|
location: "POINT(4.405819 51.221758)",
|
|
city: "Antwerp",
|
|
category: "Museum",
|
|
name: "Snijders&Rockoxhuis",
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-04T15:00:00Z",
|
|
route: 7,
|
|
location: "POINT(4.405200 51.222900)",
|
|
city: "Antwerp",
|
|
category: "Museum",
|
|
name: "Letterenhuis",
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-05T10:00:00Z",
|
|
route: 8,
|
|
location: "POINT(2.336389 48.861111)",
|
|
city: "Paris",
|
|
category: "Museum",
|
|
name: "Musée du Louvre",
|
|
},
|
|
{
|
|
index: {},
|
|
},
|
|
{
|
|
"@timestamp": "2023-01-05T14:00:00Z",
|
|
route: 9,
|
|
location: "POINT(2.327000 48.860000)",
|
|
city: "Paris",
|
|
category: "Museum",
|
|
name: "Musée dOrsay",
|
|
},
|
|
],
|
|
});
|
|
console.log(response1);
|
|
----
|