当前位置: 动力学知识库 > 问答 > 编程问答 >

How to combine missing and term filter in ElasticSearch

问题描述:

I want to return documents that either have a specific field missing or that same field has a specific value.

The following does not work:

.Filter(bf =>

bf.Missing(m => m.Name(Field1))

|| bf.Term(Field1, "Value")

I expect to get documents returned that:

  • Do not contain Field1
  • And documents that do have Field1 but have the specific value "Value"

The above code returns documents where Field1=="Value"

but does not return documents where Field1 is missing.

分享给朋友:
您可能感兴趣的文章:
随机阅读: