My dict is below
stopwords.txt
have all the stopwords
and synonym.txt
have football,soccer
abc = [
{'id':1, 'name': 'christiano ronaldo', 'description': 'football@fifa.com', 'type': 'football'},
{'id':2, 'name': 'lionel messi', 'description': 'soccer@fifa.com','type': 'soccer'},
{'id':3, 'name': 'sachin', 'description': 'was', 'type': 'cricket'}
]
- I have two txt files
stopwords.txt
andsynonym.txt
- If I am searching stopwords then those document should not return
- I need to apply settings on
name
anddescription
resp = es.search(index="players",body={
"query": {
"query_string": {
"fields": ["name^2","description^2"],
"query": "was football*"
}
}})
My out
{'took': 17,
'timed_out': False,
'_shards': {'total': 1, 'successful': 1, 'skipped': 0, 'failed': 0},
'hits': {'total': {'value': 2, 'relation': 'eq'},
'max_score': 2.345461,
'hits': [{'_index': 'players',
'_type': '_doc',
'_id': '3',
'_score': 2.345461,
'_source': {'id': 3,
'name': 'sachin',
'description': 'was',
'type': 'cricket'}},
{'_index': 'players',
'_type': '_doc',
'_id': '1',
'_score': 2.0,
'_source': {'id': 1,
'name': 'christiano ronaldo',
'description': 'football@fifa.com',
'type': 'football'}}]}}
Expected out is below
{'took': 2,
'timed_out': False,
'_shards': {'total': 1, 'successful': 1, 'skipped': 0, 'failed': 0},
'hits': {'total': {'value': 2, 'relation': 'eq'},
'max_score': 2.0,
'hits': [{'_index': 'players',
'_type': '_doc',
'_id': '1',
'_score': 2.0,
'_source': {'id': 1,
'name': 'christiano ronaldo',
'description': 'football@fifa.com',
'type': 'football'}},
{'_index': 'players',
'_type': '_doc',
'_id': '2',
'_score': 2.0,
'_source': {'id': 2,
'name': 'lionel messi',
'description': 'soccer@fifa.com',
'type': 'soccer'}}]}}