# While executing a search on preloaded data in elasticsearch, the error occurs

**URL:** <https://discuss.elastic.co/t/while-executing-a-search-on-preloaded-data-in-elasticsearch-the-error-occurs/169571>\
**Category:** Elasticsearch\
**Created:** [February 22, 2019, 11:50am UTC](https://discuss.elastic.co/t/while-executing-a-search-on-preloaded-data-in-elasticsearch-the-error-occurs/169571 "2019-02-22T11:50:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kushagra\_Makharia](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@Kushagra\_Makharia](https://discuss.elastic.co/u/Kushagra_Makharia)\
**Post date:** [February 22, 2019, 11:50am UTC](https://discuss.elastic.co/t/while-executing-a-search-on-preloaded-data-in-elasticsearch-the-error-occurs/169571/1 "2019-02-22T11:50:33Z")

</div>

## GET /sample/\_search [status:406 request:0.001s]

TransportError Traceback (most recent call last)  
 in   
----\> 1 search\_results = search\_now(text)  
2 synonyms =   
3 def check(search\_results):  
4 for text in search\_results['hits']['hits']:  
5 synonyms.append(text["\_source"]["title"])

in search\_now(text)  
4  
5 def search\_now(text):  
----\> 6 res = es.search(index=db,body=search)  
7 return (res)  
8 def syn\_search(text):

/anaconda3/lib/python3.7/site-packages/elasticsearch/client/utils.py in \_wrapped(\*args, \*\*kwargs)  
66 for p in es\_query\_params + GLOBAL\_PARAMS:  
67 if p in kwargs:  
---\> 68 v = kwargs.pop(p)  
69 if v is not None:  
70 params[p] = \_escape(v)

/anaconda3/lib/python3.7/site-packages/elasticsearch/client/ **init**.py in search(self, index, doc\_type, body, params)  
495 list of fields to return  
496 :arg \_source\_exclude: A list of fields to exclude from the returned  
--\> 497 \_source field  
498 :arg \_source\_include: A list of fields to extract and return from the  
499 \_source field

/anaconda3/lib/python3.7/site-packages/elasticsearch/transport.py in perform\_request(self, method, url, params, body)  
305 timeout = params.pop('request\_timeout', None)  
306 ignore = params.pop('ignore', ())  
--\> 307 if isinstance(ignore, int):  
308 ignore = (ignore, )  
309

/anaconda3/lib/python3.7/site-packages/elasticsearch/connection/http\_urllib3.py in perform\_request(self, method, url, params, body, timeout, ignore)  
84 raise ImproperlyConfigured("When using `ssl_context`, `use_ssl`, `verify_certs`, `ca_certs` and `ssl_version` are not permitted")  
85  
---\> 86 # if ssl\_context provided use SSL by default  
87 if use\_ssl or ssl\_context:  
88 if not ca\_certs and not ssl\_context and verify\_certs:

/anaconda3/lib/python3.7/site-packages/elasticsearch/connection/base.py in \_raise\_error(self, status\_code, raw\_data)  
100 # body has already been serialized to utf-8, deserialize it for logging  
101 # TODO: find a better way to avoid (de)encoding the body back and forth  
--\> 102 if body:  
103 body = body.decode('utf-8', 'ignore')  
104

TransportError: TransportError(406, 'Content-Type header is not supported')

Please help

---

<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:** [March 22, 2019, 11:50am UTC](https://discuss.elastic.co/t/while-executing-a-search-on-preloaded-data-in-elasticsearch-the-error-occurs/169571/2 "2019-03-22T11:50:39Z")

</div>

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