When I am using elasticsearch with python for unicode characters, I am seeing some unusual result. When we pass the query in a variable it results in No Records Found. But when we pass the query as it is in body part as mentioned in 1st example below, it gives correct result.
1-
result_set = self._elasticsearch_conn_instance.search(index='{0}'.format(self._my_index), \
size=MAX_RECORD_PER_QUERY, \
body={"query":{"constant_score":{"filter":{"bool":{"must": [{"term":{"NAME":"çãoSc"}}, {"term":{"OP":"Create"}}]}}}}}, \
sort='OP:asc,SNAP:asc')
2-
result_set = self._elasticsearch_conn_instance.search(index='{0}'.format(self._dir_index), \
size=MAX_RECORD_PER_QUERY, \
body=computed_query, \
sort='OP:asc,SNAPID:asc')
Note: In 2nd query 'computed_query' which is getting passed as body is assigned same query as in part of 1st.
1st one passes and gives correct result but the 2nd fails and says No Record Found. This case is only with Special Unicode characters and not with ASCII characters.
How can I get the correct result with 2nd query as well ?
Any help on this behavior would be useful. Thanks !!!