run a query that returns 10 results. There is a property in my document
called Type. The value of this property for some records is an empty string
and for some other records is either "AudioAlbum" or "AudioRington".
I want to do two things: 1- Exclude the documents that their Type property
does not have a value from the search result. 2- Get AudioAlbums only (as a
different search).
My search code for getting AudioAlbums is this:
var docs = client.Search(
b => b.Type("content").Query(q => q.Fuzzy(fz => fz.OnField("title").Value(keyWord).OnField("artists.name"))).Filter(x => x.Term("type", "AudioRingtone"))).Documents.ToList();
Without the Filter extension method I get 10 records (including two AudioAlbums). when I add the .Filter method I get zero records.
Also I want to exclude the records whose Type property does not have a value. Again my code (given below) does not record any results:
BaseFilter notFilter = Filter.Not(x => Filter.Term("Type", string.Empty));
var docs = client.Search(
b =>
b.Type("content")
.Query(q => q.Fuzzy(fz => fz.OnField("title").Value(keyWord).OnField("artists.name"))).Filter(notFilter)).Documents.ToList();
What's wrong with my code?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.