nest - Elasticsearch - Term null? -
i'm having trouble match null term in nest. i'm trying details via query. works ok, 1 thing can't understand - reason can't term equals null value. doing wrong?
my code:
result = _mainmanager.client.search<object> (q => q .type("mail") .query(c => c.term("sentmail_sender_id", userid) && c.term("sentmail_embedaccountid", null) && !c.term("sentmail_status", status.removed.tostring().tolower()) && c.range(v => v.onfield("sentmail_upload_files_count").greater(0))) .size(int.maxvalue) .sort(s => s.onfield("sentmail_creation_date").descending()));
it works ok, no null term found in result json:
{ "size": 2147483647, "sort": [ { "sentmail_creation_date": { "order": "desc" } } ], "query": { "bool": { "must": [ { "term": { "sentmail_sender_id": { "value": 7186 } } }, { "range": { "sentmail_upload_files_count": { "gt": "0" } } } ], "must_not": [ { "term": { "sentmail_status": { "value": "removed" } } } ] } } }
found it!
result = _mainmanager.client.search<object> (q => q .type("mail") .query(c => c.term("sentmail_sender_id", userid) && !c.term("sentmail_status", status.removed.tostring().tolower()) && c.range(v => v.onfield("sentmail_upload_files_count").greater(0))) .filter(f => f.missing("sentmail_embedaccountid")) .size(int.maxvalue) .sort(s => s.onfield("sentmail_creation_date").descending()));
Comments
Post a Comment