elasticsearch 9.1.0__py3-none-any.whl → 9.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- elasticsearch/_async/client/__init__.py +21 -6
- elasticsearch/_async/client/cat.py +1091 -51
- elasticsearch/_async/client/cluster.py +7 -2
- elasticsearch/_async/client/connector.py +3 -3
- elasticsearch/_async/client/esql.py +20 -6
- elasticsearch/_async/client/indices.py +27 -13
- elasticsearch/_async/client/inference.py +16 -5
- elasticsearch/_async/client/logstash.py +3 -1
- elasticsearch/_async/client/nodes.py +2 -2
- elasticsearch/_async/client/shutdown.py +5 -15
- elasticsearch/_async/client/sql.py +1 -1
- elasticsearch/_async/client/streams.py +186 -0
- elasticsearch/_async/client/transform.py +60 -0
- elasticsearch/_async/client/watcher.py +1 -5
- elasticsearch/_async/helpers.py +58 -9
- elasticsearch/_sync/client/__init__.py +21 -6
- elasticsearch/_sync/client/cat.py +1091 -51
- elasticsearch/_sync/client/cluster.py +7 -2
- elasticsearch/_sync/client/connector.py +3 -3
- elasticsearch/_sync/client/esql.py +20 -6
- elasticsearch/_sync/client/indices.py +27 -13
- elasticsearch/_sync/client/inference.py +16 -5
- elasticsearch/_sync/client/logstash.py +3 -1
- elasticsearch/_sync/client/nodes.py +2 -2
- elasticsearch/_sync/client/shutdown.py +5 -15
- elasticsearch/_sync/client/sql.py +1 -1
- elasticsearch/_sync/client/streams.py +186 -0
- elasticsearch/_sync/client/transform.py +60 -0
- elasticsearch/_sync/client/watcher.py +1 -5
- elasticsearch/_version.py +2 -1
- elasticsearch/client.py +2 -0
- elasticsearch/compat.py +43 -1
- elasticsearch/dsl/__init__.py +28 -0
- elasticsearch/dsl/_async/document.py +84 -0
- elasticsearch/dsl/_sync/document.py +84 -0
- elasticsearch/dsl/aggs.py +97 -0
- elasticsearch/dsl/document_base.py +57 -0
- elasticsearch/dsl/field.py +43 -11
- elasticsearch/dsl/query.py +5 -1
- elasticsearch/dsl/response/__init__.py +3 -0
- elasticsearch/dsl/response/aggs.py +1 -1
- elasticsearch/dsl/types.py +273 -24
- elasticsearch/dsl/utils.py +1 -1
- elasticsearch/esql/__init__.py +2 -1
- elasticsearch/esql/esql.py +85 -34
- elasticsearch/esql/functions.py +37 -25
- elasticsearch/helpers/__init__.py +10 -1
- elasticsearch/helpers/actions.py +106 -33
- {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/METADATA +2 -4
- {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/RECORD +53 -52
- elasticsearch/esql/esql1.py1 +0 -307
- {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/WHEEL +0 -0
- {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/licenses/LICENSE +0 -0
- {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/licenses/NOTICE +0 -0
elasticsearch/esql/esql1.py1
DELETED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
|
2
|
-
# license agreements. See the NOTICE file distributed with
|
|
3
|
-
# this work for additional information regarding copyright
|
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
|
6
|
-
# not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
|
12
|
-
# software distributed under the License is distributed on an
|
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
-
# KIND, either express or implied. See the License for the
|
|
15
|
-
# specific language governing permissions and limitations
|
|
16
|
-
# under the License.
|
|
17
|
-
|
|
18
|
-
import json
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class Query:
|
|
22
|
-
def __init__(self, parent=None):
|
|
23
|
-
self.parent = parent
|
|
24
|
-
|
|
25
|
-
def __repr__(self):
|
|
26
|
-
return self.render()
|
|
27
|
-
|
|
28
|
-
def render(self):
|
|
29
|
-
return (
|
|
30
|
-
self.parent.render() + "\n| " if self.parent else ""
|
|
31
|
-
) + self.render_basic()
|
|
32
|
-
|
|
33
|
-
def change_point(self, value, key=None, type_name=None, pvalue_name=None):
|
|
34
|
-
q = self.copy()
|
|
35
|
-
q.proc.append(
|
|
36
|
-
ChangePoint(value, key=key, type_name=type_name, pvalue_name=pvalue_name)
|
|
37
|
-
)
|
|
38
|
-
return q
|
|
39
|
-
|
|
40
|
-
def dissect(self, input, pattern, separator=None):
|
|
41
|
-
q = self.copy()
|
|
42
|
-
q.proc.append(Dissect(input, pattern, separator=separator))
|
|
43
|
-
return q
|
|
44
|
-
|
|
45
|
-
def drop(self, *columns):
|
|
46
|
-
q = self.copy()
|
|
47
|
-
q.proc.append(Drop(*columns))
|
|
48
|
-
return q
|
|
49
|
-
|
|
50
|
-
def enrich(self, policy, match_field=None, fields=None):
|
|
51
|
-
q = self.copy()
|
|
52
|
-
q.proc.append(Enrich(policy, match_field=match_field, fields=fields))
|
|
53
|
-
return q
|
|
54
|
-
|
|
55
|
-
def eval(self, *columns, **named_columns):
|
|
56
|
-
q = self.copy()
|
|
57
|
-
q.proc.append(Eval(*columns, **named_columns))
|
|
58
|
-
return q
|
|
59
|
-
|
|
60
|
-
def grok(self, input, pattern):
|
|
61
|
-
q = self.copy()
|
|
62
|
-
q.proc.append(Grok(input, pattern))
|
|
63
|
-
return q
|
|
64
|
-
|
|
65
|
-
def keep(self, *columns):
|
|
66
|
-
q = self.copy()
|
|
67
|
-
q.proc.append(Keep(*columns))
|
|
68
|
-
return q
|
|
69
|
-
|
|
70
|
-
def limit(self, max_number_of_rows):
|
|
71
|
-
q = self.copy()
|
|
72
|
-
q.proc.append(Limit(max_number_of_rows))
|
|
73
|
-
return q
|
|
74
|
-
|
|
75
|
-
def lookup_join(self, lookup_index, field):
|
|
76
|
-
q = self.copy()
|
|
77
|
-
q.proc.append(LookupJoin(lookup_index, field))
|
|
78
|
-
return q
|
|
79
|
-
|
|
80
|
-
def mv_expand(self, column):
|
|
81
|
-
q = self.copy()
|
|
82
|
-
q.proc.append(MvExpand(column))
|
|
83
|
-
return q
|
|
84
|
-
|
|
85
|
-
def rename(self, **columns):
|
|
86
|
-
q = self.copy()
|
|
87
|
-
q.proc.append(Rename(**columns))
|
|
88
|
-
return q
|
|
89
|
-
|
|
90
|
-
def sample(self, probability):
|
|
91
|
-
q = self.copy()
|
|
92
|
-
q.proc.append(Sample(probability))
|
|
93
|
-
return q
|
|
94
|
-
|
|
95
|
-
def sort(self, *columns):
|
|
96
|
-
q = self.copy()
|
|
97
|
-
q.proc.append(Sort(*columns))
|
|
98
|
-
return q
|
|
99
|
-
|
|
100
|
-
def stats(self, *expressions, groups=None):
|
|
101
|
-
q = self.copy()
|
|
102
|
-
q.proc.append(Stats(*expressions, groups=groups))
|
|
103
|
-
return q
|
|
104
|
-
|
|
105
|
-
def where(self, *anded_expressions):
|
|
106
|
-
q = self.copy()
|
|
107
|
-
q.proc.append(Where([str(expr) for expr in anded_expressions]))
|
|
108
|
-
return q
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class From(Query):
|
|
112
|
-
def __init__(self, *indices):
|
|
113
|
-
self.indices = indices
|
|
114
|
-
self.metadata_fields = tuple()
|
|
115
|
-
|
|
116
|
-
def metadata(self, *fields):
|
|
117
|
-
self.metadata_fields = fields
|
|
118
|
-
|
|
119
|
-
def render_basic(self):
|
|
120
|
-
indices = [
|
|
121
|
-
index if isinstance(index, str) else index._index._name
|
|
122
|
-
for index in self.indices
|
|
123
|
-
]
|
|
124
|
-
s = f'FROM {", ".join(indices)}'
|
|
125
|
-
if self.metadata_fields:
|
|
126
|
-
s = s + f' METADATA {", ".join(self.metadata_fields)}'
|
|
127
|
-
return s
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
class Row(Query):
|
|
131
|
-
def __init__(self, **params):
|
|
132
|
-
self.params = params
|
|
133
|
-
|
|
134
|
-
def render_basic(self):
|
|
135
|
-
return "ROW " + ", ".join(
|
|
136
|
-
[f"{k} = {json.dumps(v)}" for k, v in self.params.items()]
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
class Show(Query):
|
|
141
|
-
def __init__(self, item):
|
|
142
|
-
self.item = item
|
|
143
|
-
|
|
144
|
-
def render_basic(self):
|
|
145
|
-
return f"SHOW {self.item}"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
class ChangePoint(Query):
|
|
149
|
-
def __init__(self, value, key=None, type_name=None, pvalue_name=None):
|
|
150
|
-
self.value = value
|
|
151
|
-
self.key = key
|
|
152
|
-
self.type_name = type_name
|
|
153
|
-
self.pvalue_name = pvalue_name
|
|
154
|
-
|
|
155
|
-
def render_basic(self):
|
|
156
|
-
key = "" if not self.key else f" ON {self.key}"
|
|
157
|
-
names = (
|
|
158
|
-
""
|
|
159
|
-
if not self.type_name and not self.pvalue_name
|
|
160
|
-
else f' AS {self.type_name or "type"}, {self.pvalue_name or "pvalue"}'
|
|
161
|
-
)
|
|
162
|
-
return f"CHANGE_POINT {self.value}{key}{names}"
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
class Dissect(Query):
|
|
166
|
-
def __init__(self, input, pattern, separator=None):
|
|
167
|
-
self.input = input
|
|
168
|
-
self.pattern = pattern
|
|
169
|
-
self.separator = separator
|
|
170
|
-
|
|
171
|
-
def render_basic(self):
|
|
172
|
-
sep = "" if self.separator is None else f' APPEND_SEPARATOR="{self.separator}"'
|
|
173
|
-
return f"DISSECT {self.input} {json.dumps(self.pattern)}{sep}"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
class Drop(Query):
|
|
177
|
-
def __init__(self, *columns):
|
|
178
|
-
self.columns = columns
|
|
179
|
-
|
|
180
|
-
def render_basic(self):
|
|
181
|
-
return f'DROP {", ".join([str(col) for col in self.columns])}'
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
class Enrich(Query):
|
|
185
|
-
def __init__(self, policy, match_field=None, fields=None):
|
|
186
|
-
self.policy = policy
|
|
187
|
-
self.match_field = match_field
|
|
188
|
-
self.fields = fields
|
|
189
|
-
|
|
190
|
-
def render_basic(self):
|
|
191
|
-
on = "" if self.match_field is None else f" ON {self.match_field}"
|
|
192
|
-
with_ = ""
|
|
193
|
-
if isinstance(self.fields, dict):
|
|
194
|
-
with_ = f' WITH {", ".join([f"{name} = {field}" for name, field in self.fields.items()])}'
|
|
195
|
-
elif self.fields is not None:
|
|
196
|
-
with_ = f' WITH {", ".join(self.fields)}'
|
|
197
|
-
return f"ENRICH {self.policy}{on}{with_}"
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
class Eval(Query):
|
|
201
|
-
def __init__(self, *columns, **named_columns):
|
|
202
|
-
self.columns = columns
|
|
203
|
-
self.named_columns = named_columns
|
|
204
|
-
|
|
205
|
-
def render_basic(self):
|
|
206
|
-
named = ", ".join(
|
|
207
|
-
[f"{name} = {value}" for name, value in self.named_columns.items()]
|
|
208
|
-
)
|
|
209
|
-
unnamed = ", ".join(self.columns)
|
|
210
|
-
sep = "" if named == "" or unnamed == "" else ", "
|
|
211
|
-
return f"EVAL {named}{sep}{unnamed}"
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
class Grok(Query):
|
|
215
|
-
def __init__(self, input, pattern):
|
|
216
|
-
self.input = input
|
|
217
|
-
self.pattern = pattern
|
|
218
|
-
|
|
219
|
-
def render_basic(self):
|
|
220
|
-
return f"GROK {self.input} {json.dumps(self.pattern)}"
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
class Keep(Query):
|
|
224
|
-
def __init__(self, *columns):
|
|
225
|
-
self.columns = columns
|
|
226
|
-
|
|
227
|
-
def render_basic(self):
|
|
228
|
-
return f'KEEP {", ".join(self.columns)}'
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
class Limit(Query):
|
|
232
|
-
def __init__(self, max_number_of_rows):
|
|
233
|
-
self.max_number_of_rows = max_number_of_rows
|
|
234
|
-
|
|
235
|
-
def render_basic(self):
|
|
236
|
-
return f"LIMIT {self.max_number_of_rows}"
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
class LookupJoin(Query):
|
|
240
|
-
def __init__(self, lookup_index, field):
|
|
241
|
-
self.lookup_index = lookup_index
|
|
242
|
-
self.field = field
|
|
243
|
-
|
|
244
|
-
def render_basic(self):
|
|
245
|
-
return f"LOOKUP JOIN {self.lookup_index} ON {self.field}"
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
class MvExpand(Query):
|
|
249
|
-
def __init__(self, column):
|
|
250
|
-
self.column = column
|
|
251
|
-
|
|
252
|
-
def render_basic(self):
|
|
253
|
-
return f"MV_EXPAND {self.column}"
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
class Rename(Query):
|
|
257
|
-
def __init__(self, **columns):
|
|
258
|
-
self.columns = columns
|
|
259
|
-
|
|
260
|
-
def render_basic(self):
|
|
261
|
-
return f'RENAME {", ".join([f"{old_name} = {new_name}" for old_name, new_name in self.columns.items()])}'
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
class Sample(Query):
|
|
265
|
-
def __init__(self, probability):
|
|
266
|
-
self.probability = probability
|
|
267
|
-
|
|
268
|
-
def render_basic(self):
|
|
269
|
-
return f"SAMPLE {self.probability}"
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
class Sort(Query):
|
|
273
|
-
def __init__(self, *columns):
|
|
274
|
-
self.columns = columns
|
|
275
|
-
|
|
276
|
-
def render_basic(self):
|
|
277
|
-
return f'SORT {", ".join(self.columns)}'
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
class Stats(Query):
|
|
281
|
-
def __init__(self, *expressions, groups=None):
|
|
282
|
-
self.expressions = expressions
|
|
283
|
-
self.groups = groups
|
|
284
|
-
|
|
285
|
-
def render_basic(self):
|
|
286
|
-
by = "" if self.groups is None else f'BY {", ".join(self.groups)}'
|
|
287
|
-
return f'STATS {", ".join(self.expressions)}{by}'
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
class Where(Query):
|
|
291
|
-
def __init__(self, anded_expressions):
|
|
292
|
-
self.anded_expressions = anded_expressions
|
|
293
|
-
|
|
294
|
-
def render_basic(self):
|
|
295
|
-
return f'WHERE {" AND ".join(self.anded_expressions)}'
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
def esql_from(*indices, metadata_fields=None):
|
|
299
|
-
return Query(From(*indices, metadata_fields=metadata_fields))
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
def esql_row(**params):
|
|
303
|
-
return Query(Row(*params))
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
def esql_show(item):
|
|
307
|
-
return Query(Show(item))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|