ElasticSearch and Nest filtering does not work

有些话、适合烂在心里 提交于 2019-12-05 20:54:42
Martijn Laarman

Copy Pasted Answer from the elasticsearch user list

In your first example you filter on the field "type" and in the second on the "Type" I suppose you need to change the first to "Type".

Depending on your analysis for the "Type" field you might also need to lowercase "AudioRingtone" too.

In the second example you are using the wrong query:

http://www.elasticsearch.org/guide/reference/query-dsl/missing-filter/

Which in NEST you can do as such:

https://github.com/elasticsearch/elasticsearch-net/blob/master/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/MissingFilterJson.cs

If you issue an empty term filter/query you hit NEST conditionless query logica, and nest will infact not even send the filter at all.

See http://nest.azurewebsites.net/nest/writing-queries.html for help using the query dsl.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!