我在经典的
ELK配置中有一个
Kibana server,查询
Elasticsearch实例.
我使用Kibana控制台对elasticsearch执行复杂的查询.我想使用cURL或任何其他http工具在命令行中使用其中一些查询.
如何将Kibana搜索转换为direct,cURL-like REST call to elasticsearch?
解决方法
在可视化底部,您可以单击一个小插入符号以查看有关基础查询的更多详细信息:
然后,您可以单击“请求”按钮以查看基础查询,您可以复制/粘贴并执行适合您的任何操作.
UPDATE
然后,您可以从“请求”文本区域复制/粘贴查询,只需将其粘贴到如下的卷曲中:
curl -XPOST localhost:9200/your_index/your_type/_search -d '{ "query": { "filtered": { "query": { "query_string": { "analyze_wildcard": true,"query": "blablabla AND blablabla" } },"filter": { "bool": { "must": [ { "range": { "@timestamp": { "gte": 1439762400000,"lte": 1439848799999 } } } ],"must_not": [] } } } },"highlight": { "pre_tags": [ "@kibana-highlighted-field@" ],"post_tags": [ "@/kibana-highlighted-field@" ],"fields": { "*": {} } },"size": 420,"sort": { "@timestamp": "desc" },"aggs": { "2": { "date_histogram": { "field": "@timestamp","interval": "30m","pre_zone": "+02:00","pre_zone_adjust_large_interval": true,"min_doc_count": 0,"extended_bounds": { "min": 1439762400000,"max": 1439848799999 } } } },"fields": [ "*","_source" ],"script_fields": {},"fielddata_fields": [ "@timestamp" ] }'
你可能需要调整一些东西(比如前/后高亮标签等)