简体   繁体   中英

use Elasticsearch Ranged queries in grafana

I have a elasticsearch range query like this

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. i am trying to add this as a part of the Lucene query. 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:[174 TO 180]

reference: 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:

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    
                    }
                }
            }
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM