I have a Filtred Query.
I first case I user full text search:
{ 'query': {'filtered': {'filter': {'bool': {'must': [{'term': {'status': 4}}]}},
'query': {'bool': {'should': [{'match': {'name': {'operator': 'and',
'query': 'dog'}}},
{'match': {'description': {'boost': 0.9,
'operator': 'and',
'query': 'dog'}}},
{'match': {'author': {'boost': 0.8,
'operator': 'and',
'query': 'dog'}}},
{'match': {'tags': {'boost': 0.7,
'operator': 'and',
'query': 'dog'}}}]}}
In second case I use range filter:
{'query': {'filtered': {'filter': {'bool': {'must': [{'term': {'status': 4}},
{'range': {'year_to': {'lte': '1946'}}}]}}}}
I was very surprised, because second request takes 2 times more CPU than the first one;
What is going on?
My mapping:
"properties": {
"id": {
"type": "integer"
},
"name": {
"analyzer": "russian_morphology",
"type": "string"
},
"description": {
"analyzer": "russian_morphology",
"type": "string"
},
"status": {
"type": "integer"
},
"tags": {
"analyzer": "russian_morphology",
"type": "string"
},
"year_from": {
"type": "integer"
},
"year_to": {
"type": "integer"
}