Below is my dictionary
abc = [
{'id':"1", 'name': 'cristiano ronaldo', 'description': 'portugal@fifa.com'},
{'id':"2", 'name': 'lionel messi', 'description': 'argentina@fifa.com'},
{'id':"3", 'name': 'Lionel Jr', 'description': 'brazil@fifa.com'}
]
Ingested the players into elasticsearch
for i in abc:
es.index(index="players", body=i, id=i['id'])
Below is the dsl query
resp = es.search(index="players",body={
"query": {
"query_string": {
"fields": ["id^12","description^2", "name^2"],
"query": "brazil@fifa.com"
}
}})
resp
Issue 1: if
"fields": ["id^12","description^2", "name^2"]
then i am getting errorRequestError: RequestError(400, 'search_phase_execution_exception', 'failed to create query: For input string: "brazil@fifa.com"'
Issue 2: if my fields are
["description^2", "name^2"]
I am expecting one document which containbrazil@fifa.com
but returning all 3 documents
Edited: From the comment of sagar my setting id was long which i changed now . mapping is below. and issue1 is resolved
{'players': {'mappings': {'properties': {'description': {'type': 'text',
'fields': {'keyword': {'type': 'keyword', 'ignore_above': 256}}},
'id': {'type': 'text',
'fields': {'keyword': {'type': 'keyword', 'ignore_above': 256}}},
'name': {'type': 'text',
'fields': {'keyword': {'type': 'keyword', 'ignore_above': 256}}}}}}}