Elasticsearch screwing up the score with a date range filter


(Saurabh Wahile) #1

Hello,

I have a query which is matching with any documents that satisfy the filter, but none of the objects have, a match. The scores also, are weird, with sometimes the score returned as 0.

<>
{'highlight': {'fields': {'': {'post_tags': '', 'pre_tags': ''}}},
'query': {'bool': {'filter': {'range': {'es_timestamp': {'format': 'yyyy/mm/dd||yyyy/mm/dd',
'gte': '1999/01/01',
'lte': '2016/10/04'}}},
'should': [{'multi_match': {'boost': 1,
'fields': ['ca_name',
'ca_fathername',
'ca_spousename'],
'query': 'NAME'}},
{'term': {'dob': {'boost': 1.5,
'value': '1972-06-01'}}},
{'multi_match': {'boost': 2,
'fields': ['ca_mobile',
'ca_mobile2',
'ca_offcmobile',
'ca_offcmobile2'],
'query': 'XXXX XXXX',
'type': 'cross_fields'}},
{'term': {'ca_aadharcardno': {'boost': 2,
'value': 'XXXXXX'}}},
{'term': {'ca_pan': {'boost': 2, 'value': ''}}},
{'term': {'ca_drivinglicense': {'boost': 2,
'term': ''}}},
{'term': {'ca_passport': {'boost': 2,
'value': ''}}},
{'term': {'ca_voterid': {'boost': 2,
'value': ''}}},
{'term': {'ca_gascardno': {'boost': 2,
'term': ''}}},
{'match_phrase': {'ca_add1': {'boost': 1,
'query': 'ADDRESS'}}},
{'match_phrase': {'ca_permntadd1': {'boost': 1,
'query': 'ADDRESS'}}}]}}}
</>


(Zachary Tong) #2

The score of 0 is because a document matched the filter but nothing else in the query. Filters don't contribute to the score, but will include the document in the hits, so their score will be zero.

I'm afraid I don't understand the rest of your question, could you rephrase a bit?


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.