You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/helpers.asciidoc
+35-17Lines changed: 35 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,7 +165,9 @@ scroll_helper.clear
165
165
[[esql-helper]]
166
166
=== ES|QL Helper
167
167
168
-
This helper provides an object response from the ESQL `query` API instead of the default JSON value.
168
+
This functionality is Experimental and may be changed or removed completely in a future release. If you have any feedback on this helper, please https://github.com/elastic/elasticsearch-ruby/issues/new/choose[let us know].
169
+
170
+
The helper provides an object response from the ESQL `query` API instead of the default JSON value.
169
171
170
172
To use the ES|QL helper, require it in your code:
171
173
@@ -208,32 +210,48 @@ The helper returns an array of hashes with the columns as keys and the respectiv
Additionally, a block can be specified to transform the response data. Pass in a block to `query` and it will yield each item in the array of responses.
224
+
Additionally, you can transform the data in the response by passing in a Hash of `column => Proc` values. You could use this for example to convert '@timestamp' into a DateTime object. Pass in a Hash to `query` as a `parser` defining a `Proc` for each value you'd like to parse:
227
225
228
-
You could use this for example to convert '@timestamp' into a DateTime object:
229
226
[source,ruby]
230
227
----
231
228
require 'elasticsearch/helpers/esql_helper'
232
229
233
-
response = esql_helper.query(client, query).each do |r|
0 commit comments