I'm using the basic elasticsearch library in python 3.
I have a query:
query = {
"query": {
"bool": {
"must": [{ "term": {"hostname": '"hal-pc"' } }]
}
}
}
That I call with:
page = es.search(index = index_name, body=query, search_type='scan', scroll='2m')
However I'm not getting any results. I can query on other fields so I know my query works, but when I add the search for a field with a hyphen in the value, I cannot find anything. How can I escape this character? I know that with normal ES queries you can send a message to configure your ES to respond to certain characters in certain ways, but I don't know how to do that in python.
hostnameanalyzed in elasticsearch mapping?