How to query lucene for empty fields?

前端 未结 3 1917
小蘑菇
小蘑菇 2020-12-30 02:12

I want in 2nd part of my query to have a list of result for while data not null. I find how do it in solr but not in lucene. Anyone have a idea Thanks

String :

相关标签:
3条回答
  • 2020-12-30 02:33

    -_exists_:field_one works for me in ElasticSearch 6.0

    reference: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/query-dsl-query-string-query.html#_field_names

    0 讨论(0)
  • 2020-12-30 02:52
    *:* -MY_FIELD_NAME:[* TO "zzzzzzzzzz"]
    

    You can add more "z" chars to ensure to include any value of the field.

    0 讨论(0)
  • 2020-12-30 03:00
    *:*  -MY_FIELD_NAME:[* TO *] 
    

    The above should do it, note the * : * for Lucene.

    0 讨论(0)
提交回复
热议问题