I have a list of items as:
i = SearchQuerySet().models(Item)
now, each item in i
has a attribute, price
I wan
The double negated query suggested by Maurizio may cause error:
unexpected docvalues type NUMERIC for field 'price' (expected one of [SORTED, SORTED_SET]). Re-index with correct docvalues type.
(Even after re-indexing. This may have something to do with the index
and store
and docvalues
settings of the field.)
What you could do instead is exempt both ranges (before and after) of the values you are actually interested in:
-(price:[* TO 300} price:{400 TO *])
Note that values 300 and 400 are excluded by using curly brackets in this negated query and are thus included in the search results.