RequestError: TransportError (400, u'parsing_exception ')

I am using django-haystack and Elasticsearch for my application. I downloaded all the requirements and tried to find my indexes using search.html

But whenever I tried to get the results using the API in http: // localhost: 8000 / search , I get the following error, and I strongly searched googled about it, but could not get any help:

RequestError: TransportError(400, u'parsing_exception')

The full error I get is:

 Traceback (most recent call last): File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 524, in search _source=True) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped return func(*args, params=params, **kwargs) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 530, in search doc_type, '_search'), params=params, body=body) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/transport.py", line 307, in perform_request status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 93, in perform_request self._raise_error(response.status, raw_data) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/connection/base.py", line 105, in _raise_error raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info) RequestError: TransportError(400, u'parsing_exception') Failed to query Elasticsearch using '(sdf)': TransportError(400, u'parsing_exception') Traceback (most recent call last): File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 524, in search _source=True) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped return func(*args, params=params, **kwargs) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 530, in search doc_type, '_search'), params=params, body=body) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/transport.py", line 307, in perform_request status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 93, in perform_request self._raise_error(response.status, raw_data) File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/elasticsearch/connection/base.py", line 105, in _raise_error raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info) RequestError: TransportError(400, u'parsing_exception') 

I do not understand what a mistake is. Can't send a search request?

Elasticsearch views.py search function:

 def elastic_search(request): recordings = None if request.GET.get('q'): form = RecordingsSearchForm(request.GET, searchqueryset=None, load_all=True) searchqueryset = form.search() print ("----------- searchqueryset", searchqueryset) results = [ r.pk for r in searchqueryset ] print ("-----------", results) recordings = Recordings.objects.filter(pk__in=results) print ("-----------", recordings) return render_to_response('search/search.html', {'recordings': recordings}); 

search.html

  <h2>Search</h2> <form method="get" action="."> <table> {{ form.as_table }} <tr> <td>&nbsp;</td> <td> <input type="submit" value="Search"> </td> </tr> </table> {% if query %} <h3>Results</h3> {% for result in page.object_list %} <p> <a href="{{ result.object.get_absolute_url }}">{{ result.object.title }}</a> </p> {% empty %} <p>No results found.</p> {% endfor %} {% if page.has_previous or page.has_next %} <div> {% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %} | {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %} </div> {% endif %} {% else %} {# Show some example queries to run, maybe query syntax, something else? #} {% endif %} </form> 
0
source share

Source: https://habr.com/ru/post/1013571/


All Articles