[英]use Elasticsearch Ranged queries in grafana
I have a elasticsearch range query like this 我有这样的Elasticsearch范围查询
curl 'localhost:9200/myindex/_search?pretty' -d '
{
"query": {
"range" : {
"total" : {
"gte" :174,
"lte" :180
}
}
}
}'
I need to use this query in grafana for my graph. 我需要在grafana中为我的图表使用此查询。 i am trying to add this as a part of the Lucene query.
我试图将其添加为Lucene查询的一部分。 but i am not able to find the desired result.
但我找不到想要的结果。 can anyone help.
谁能帮忙。
If "total" is a field, you can do something like this in Lucene: 如果“ total”是一个字段,则可以在Lucene中执行以下操作:
total:[174 TO 180]
reference: https://lucene.apache.org/core/2_9_4/queryparsersyntax.html 参考: https : //lucene.apache.org/core/2_9_4/queryparsersyntax.html
First off I think you may be missing the document type from the request URL, should look like so: 首先,我认为您可能缺少请求URL中的文档类型,应如下所示:
http://localhost:9200/[INDEX]/[TYPE]/_search?pretty
Second, I've looked at previous answers providing detailed examples of range filtering and the query should work just fine like so 其次,我查看了先前的答案,其中提供了范围过滤的详细示例,查询应该可以像这样正常工作
{
"query":
{
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"range": {
"total": {
"gte": 174,
"lte": 180
}
}
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.