# Elastic Search with Special Characters

**URL:** <https://discuss.elastic.co/t/elastic-search-with-special-characters/143554>\
**Category:** Elasticsearch\
**Created:** [August 8, 2018, 3:16pm UTC](https://discuss.elastic.co/t/elastic-search-with-special-characters/143554 "2018-08-08T15:16:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktvasan](https://avatars.discourse-cdn.com/v4/letter/k/0ea827/32.png) [@ktvasan](https://discuss.elastic.co/u/ktvasan)\
**Post date:** [August 8, 2018, 3:16pm UTC](https://discuss.elastic.co/t/elastic-search-with-special-characters/143554/1 "2018-08-08T15:16:49Z")

</div>

I am using Elastic search api for python to pull some data for creating my own dashboards, Its working for several queries/dashboards no issues. But this below query string some how it's not returning any results or giving me the errors from Elastic search api from my python script, however I am able to query from Firefox browser without any issues and got the data back.

I know there might be issue with

{"query": "NOT source:"p\_prodsearchwww3"", "analyze\_wildcard": "true"}

If I replaced this {"query": "\*", "analyze\_wildcard": "true"} with above one its rerturning data.

I also did a escape like

{"query": "NOT source:"p\_prodsearchwww3"", "analyze\_wildcard": "true"}

But its not working.

Here is the code from my python script:

es = Elasticsearch([{'host': 'X.X.X.X', 'port': 9200}], http\_auth=('user', 'pass'))  
res = es.search(request\_timeout=300, index="my\_index-\*", body=query\_string)

any one know what am I missing?

http://es\_server:9200/my\_index\_logs-_/\_search?source={"query": {"bool": {"must": [{"query\_string": {"query": "NOT source:"p\_prodsearchwww3"", "analyze\_wildcard": "true"}}, {"query\_string": {"analyze\_wildcard": "true", "query": "_"}}, {"range": {"log\_timestamp": {"gte": "1532529061000", "lte": "1533738661000", "format": "epoch\_millis"}}}], "must\_not": []}}, "size": 0, "\_source": {"excludes": []}, "aggs": {"2": {"date\_histogram": {"field": "log\_timestamp", "interval": "30s", "time\_zone": "America/Chicago", "min\_doc\_count": 1},"aggs": {"3": {"terms": {"field": "class.keyword", "size": 5, "order": {"\_count": "desc"}}}}}}, "version": "true", "highlight": {"pre\_tags": ["@kibana-highlighted-field@"], "post\_tags": ["@/kibana-highlighted-field@"], "fields": {"_": {"highlight\_query": {"bool": {"must": [{"query\_string": {"query": "NOT source:"p\_prodsearchwww3"", "analyze\_wildcard": "true", "all\_fields": "true"}}, {"query\_string": {"analyze\_wildcard": "true", "query": "_", "all\_fields": "true"}}, {"range": {"log\_timestamp": {"gte": "1532529061000", "lte": "1533738661000", "format": "epoch\_millis"}}}], "must\_not": []}}}}, "fragment\_size": 2147483647}}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 5, 2018, 3:16pm UTC](https://discuss.elastic.co/t/elastic-search-with-special-characters/143554/2 "2018-09-05T15:16:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
