Reputation: 211
I have data with different dynamic field. i want to apply the condition in exists field record and i need not exists field records also. My Solr version 6.1.0
{"employeeid" : "220", "displayname_s": "abu", "attr_36977": 55 },
{"employeeid" : "910", "displayname_s": "test","attr_36400": 565 },
{"employeeid" : "210", "displayname_s": "sam"},
{"employeeid" : "64", "displayname_s": "wel", "attr_36977": 152},
i write a query like this
(-attrl_36977:[* TO *] OR attrl_36977:[0 TO 100])
but this query not workout.
the idle result is first three records(220,910,210). how to solve the requirement
Upvotes: 1
Views: 1627
Reputation: 52792
You have to be explicit about what you're subtracting the first part of your OR statement from:
(*:* -attrl_36977:[* TO *]) OR attrl_36977:[0 TO 100]
.. will give you any documents that doesn't have a value in attrl_36977
or a value between 0 and 100 inclusive.
Upvotes: 4