i'm trying to create a query in NEST that would be like:
get * where CityName!='' and StreetName!=''
Using the existing and missing filters is not helping because the fields are not null. I also tried to use the queryString with the wildcard (*) but i get all the documents back in the result. I also tried a script filter like this :
qq.Filtered(ft => ft.Filter(f => f.Script(s => s.Script("doc['cityName'].value.length() > 0"))));
Also not working. The fields are indexed with standard tokenizer and also using ICU folding. Any solution ?
UPDATE !!!!
I managed to do this stuff by using the Regexp filter. so it's something like this :
QueryContainer notNullQuery = null;
notNullQuery &= qq.Filtered(ft => ft.Filter(f => f.Regexp(r => r.OnField(ff => ff.StdCityName).Value("[a-z0-9]+[\\s]?"))));
notNullQuery &= qq.Filtered(ft => ft.Filter(f => f.Regexp(r => r.OnField(ff => ff.StdStreetCode).Value("[0-9]+"))));
notNullQuery &= qq.Filtered(ft => ft.Filter(f => f.Regexp(r => r.OnField(ff => ff.StdStreetPostCode).Value("[a-z0-9]+[\\s]?"))));
notNullQuery &= qq.Filtered(ft => ft.Filter(f => f.Regexp(r => r.OnField(ff => ff.LastName1).Value("[a-z0-9]+[\\s]?"))));
notNullQuery &= qq.Filtered(ft => ft.Filter(f => f.Regexp(r => r.OnField(ff => ff.FirstName1).Value("[a-z0-9]+[\\s]?"))));
notNullQuery &= qq.Filtered(ft => ft.Filter(f => f.Regexp(r => r.OnField(ff => ff.SourceDisplayPhone).Value("[0-9]+"))));
return notNullQuery;
LATER UPDATE: For NEST 5.x index the field as Keyword then do a query search on term. Don't forget to put Verbatim() or the query will not be sent to server.
qq.Bool(b => b.MustNot(mn => mn.Term(t => t.Field(f => f.Email).Value("").Verbatim())));