Json Input in Kibana

Hi there!
How can I use Json Input in visualizations? More than this example: { "script" : "doc['grade'].value * 1.2" } I haven't find. Do you have some more examples of using Json Input?

My task:

  • List item I have documents with @timestamp in ElasticSearch, I need to get just documents with time period between 0 a.m and 8.a.m.

  • List item I have already created Scripted field (hourOfDay) which shows only TIME from @timestamp field.
    But unfortunately filter with this Scripted field doesn't work..

Do you have any recommendations how can I get needed result?

1 Like

You can paste JSON-based Elasticsearch DSL queries in the search bar at the top of the screen. The following one-liner, pasted in the search bar will give you the desired results:

{ "script": { "script": { "inline": "doc['@timestamp'].date.getHourOfDay() >= params.min && doc['@timestamp'].date.getHourOfDay() < params.max", "params": { "min": 0, "max": 8 } } } }

Be careful though, scripted queries are computationally expensive.

Thx, Abdon! It works correctly!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.