File: 89dee10a24ea2727af5b00039a4271bd.asciidoc

package info (click to toggle)
python-elasticsearch 9.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 22,728 kB
  • sloc: python: 104,053; makefile: 151; javascript: 75
file content (163 lines) | stat: -rw-r--r-- 4,150 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geoline-aggregation.asciidoc:159

[source, python]
----
resp = 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"
            }
        }
    },
)
print(resp)

resp1 = 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"
        }
    ],
)
print(resp1)
----