Error in matching the empty String

Hi All,

Here i am using searchQuery in the Full text search,If i want get the record with the type = “” and type = “private”

SearchQuery.match(“private”).field(“type”) – Working

SearchQuery.match("").field(“type”) – Not Working

i want to get the records rather that private type, can any once help in this to get the records.

You could use a boolean must_not query to achieve this. Assuming that your index contains only documents of these two types (empty and private types) you may try a boolean query like below.

curl -XPOST -u uname:pwd  -H "Content-Type: application/json" -d '{
"query": {"must_not": {"disjuncts": [{"field": "type", "match": "private"}]}}}' 


i was tried with the above scenerio , i used like

const BooleanQuery = new SearchQuery.BooleanQuery();

but i am getting some documents which having the type “Private”

Can you share your index definition to understand this better.