Create Elasticsearch curl query for not null and not empty(“”)

后端 未结 12 981
陌清茗
陌清茗 2020-12-13 01:21

How can i create Elasticsearch curl query to get the field value which are not null and not empty(\"\"),

Here is the mysql query:

select field1 from          


        
12条回答
  •  死守一世寂寞
    2020-12-13 02:17

    You can do that with bool query and combination of must and must_not like this:

    GET index/_search
    {
        "query": {
            "bool": {
                "must": [
                    {"exists": {"field": "field1"}}
                ],
                "must_not": [
                    {"term": {"field1": ""}}
                ]
            }
        }
    }
    

    I tested this with Elasticsearch 5.6.5 in Kibana.

提交回复
热议问题