# Elasticsearch screwing up the score with a date range filter

**URL:** <https://discuss.elastic.co/t/elasticsearch-screwing-up-the-score-with-a-date-range-filter/136090>\
**Category:** Elasticsearch\
**Created:** [June 15, 2018, 11:58am UTC](https://discuss.elastic.co/t/elasticsearch-screwing-up-the-score-with-a-date-range-filter/136090 "2018-06-15T11:58:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![saurabhwahile](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@saurabhwahile](https://discuss.elastic.co/u/saurabhwahile)\
**Post date:** [June 15, 2018, 11:58am UTC](https://discuss.elastic.co/t/elasticsearch-screwing-up-the-score-with-a-date-range-filter/136090/1 "2018-06-15T11:58:31Z")

</div>

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'}}}]}}}  
\</\>

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [June 22, 2018, 5:57pm UTC](https://discuss.elastic.co/t/elasticsearch-screwing-up-the-score-with-a-date-range-filter/136090/2 "2018-06-22T17:57:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 20, 2018, 5:57pm UTC](https://discuss.elastic.co/t/elasticsearch-screwing-up-the-score-with-a-date-range-filter/136090/3 "2018-07-20T17:57:39Z")

</div>

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