26
26
class EsqlClient (NamespacedClient ):
27
27
28
28
@_rewrite_parameters (
29
- body_fields = ("query" , "columnar" , "filter" , "locale" , "params" ),
29
+ body_fields = ("query" , "version" , " columnar" , "filter" , "locale" , "params" ),
30
30
ignore_deprecated_options = {"params" },
31
31
)
32
32
async def query (
33
33
self ,
34
34
* ,
35
35
query : t .Optional [str ] = None ,
36
+ version : t .Optional [t .Union ["t.Literal['2024.04.01']" , str ]] = None ,
36
37
columnar : t .Optional [bool ] = None ,
37
38
delimiter : t .Optional [str ] = None ,
38
39
error_trace : t .Optional [bool ] = None ,
@@ -52,6 +53,8 @@ async def query(
52
53
53
54
:param query: The ES|QL query API accepts an ES|QL query string in the query
54
55
parameter, runs it, and returns the results.
56
+ :param version: The version of the ES|QL language in which the "query" field
57
+ was written.
55
58
:param columnar: By default, ES|QL returns results as rows. For example, FROM
56
59
returns each individual document as one row. For the JSON, YAML, CBOR and
57
60
smile formats, ES|QL can return the results in a columnar fashion where one
@@ -68,6 +71,8 @@ async def query(
68
71
"""
69
72
if query is None and body is None :
70
73
raise ValueError ("Empty value passed for parameter 'query'" )
74
+ if version is None and body is None :
75
+ raise ValueError ("Empty value passed for parameter 'version'" )
71
76
__path_parts : t .Dict [str , str ] = {}
72
77
__path = "/_query"
73
78
__query : t .Dict [str , t .Any ] = {}
@@ -87,6 +92,8 @@ async def query(
87
92
if not __body :
88
93
if query is not None :
89
94
__body ["query" ] = query
95
+ if version is not None :
96
+ __body ["version" ] = version
90
97
if columnar is not None :
91
98
__body ["columnar" ] = columnar
92
99
if filter is not None :
0 commit comments