Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request Error: no [query] registered for [filtered] #1579

Open
2 tasks done
whob13 opened this issue Dec 22, 2017 · 15 comments
Open
2 tasks done

Request Error: no [query] registered for [filtered] #1579

whob13 opened this issue Dec 22, 2017 · 15 comments

Comments

@whob13
Copy link

whob13 commented Dec 22, 2017

  • Tested with the latest Haystack release
  • Tested with the current Haystack master branch

Expected behaviour

I set up the Haystack search page based on the readthedocs tutorial and I'm getting an error for any search that I perform on the model I configured. I submit a search and get this error message in return

Actual behaviour

raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info) RequestError: TransportError(400, u'parsing_exception', u'no [query] registered for [filtered]')

Steps to reproduce the behaviour

search.html

{% extends 'layouts/base.html' %}
{% block title %}
    Homepage - {{ block.super }}
{% endblock %}
{% block content %}
    <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 object_list %}
                <p>
                    <a href="{{ result.object.get_absolute_url }}">{{ result.object.name }}</a>
                </p>
            {% empty %}
                <p>No results found.</p>
            {% endfor %}

            {% if has_previous or has_next %}
                <div>
                    {% if has_previous %}<a href="?q={{ query }}&amp;{{ previous_number }}">{% endif %}&laquo; Previous{% if has_previous %}</a>{% endif %}
                    |
                    {% if has_next %}<a href="?q={{ query }}&amp;{{ next_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>
{% endblock %}

search_indexes.py

import datetime
from haystack import indexes
from .models import *


class SponsorIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)
    name = indexes.CharField(model_attr='name')
    lifetime_value = indexes.DecimalField(model_attr='lifetime_value',default=0)
    number_of_events_sponsored = indexes.IntegerField(model_attr='number_of_events_sponsored',default=0)
    date_created = indexes.DateField(model_attr='date_created')

    def get_model(self):
        return Sponsor

    def index_queryset(self, using=None):
        """Used when the entire index for model is updated."""
        return self.get_model().objects.filter(date_created__lte=datetime.datetime.now())

Sponsor model

class Sponsor(models.Model):
    name = models.CharField(max_length=255)
    email = models.EmailField(max_length=255,null=True,blank=True)
    contacts = models.ManyToManyField(
        'User',
        blank=True,
        )
    lifetime_value = models.DecimalField(max_digits=12,decimal_places=2,null=True,blank=True)
    number_of_events_sponsored = models.IntegerField(null=True,blank=True)
    average_amount_spent_per_sponsorship = models.DecimalField(max_digits=12,decimal_places=2,null=True,blank=True)
    date_created = models.DateField(auto_now_add=True)

    def __unicode__(self):
        return self.name

    def indexing(self):
        obj = SponsorIndex(
            meta={'id': self.id},
            name=self.name,
            date_created=self.date_created,
            lifetime_value=self.lifetime_value,
            )
        obj.save()
        return obj.to_dict(include_meta=True)

Configuration

  • Operating system version: Mac OS
  • Search engine version: Elastic Search 5.1.1
  • Python version: 2.7.10
  • Django version: 1.11.8
  • Haystack version: 2.6.1
@kdbusiness90
Copy link

@whob13, Elasticsearch 5.x is not supported yet, pls visit doc http://django-haystack.readthedocs.io/en/master/installing_search_engines.html

radeksh referenced this issue Jul 11, 2018
* Add 5.x to supported versions
* Replace configuration and installation information with
  pointers to the official docs
* Stop mentioning pyes since it’s fallen behind the official
  client in awareness
* Don’t tell people how to install Python packages
@radeksh
Copy link

radeksh commented Jul 11, 2018

Docs now saying that 5.x is supported, but the problem remains.

@vadimber1
Copy link

Same, got this problem with 5.x

@acdha
Copy link
Contributor

acdha commented Jul 12, 2018

ES5 is supported and works. I would check your configuration against the test suite’s first

@knazarov
Copy link

knazarov commented Aug 3, 2018

There is actully no elasticsearch5_backend in the latest stable release (2.8.1). Looks like it's not yet released.

@mpdevilleres
Copy link

mpdevilleres commented Aug 16, 2018

I agree with @racktear, elasticsearch5_backend is not part of 2.8.1, but it's in the master branch.

for those who wants to try it out, install master using git.
pip install git+https://github.com/django-haystack/django-haystack

@acdha
Copy link
Contributor

acdha commented Aug 16, 2018

As always, testing is appreciated. I have very limited time available to work on Haystack these days and if someone would like to take over maintaining the ElasticSearch support it'd be a great contribution.

@knazarov
Copy link

@acdha I've had success with ES5 support in master. Just maybe release a new version?

@wasi0013
Copy link

wasi0013 commented Sep 23, 2018

I'm having the same issue with elastic search 6.4.0

in _raise_error raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info) elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', 'no [query] registered for [filtered]')

@Bearshanjun
Copy link

I'm also having the same issue with elastic search 5.6.1, Can someone help me?

elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')

@heavenkiller2018
Copy link

elasticsearch 6.6我也有同样的问题,有人能帮帮我吗?

elasticsearch.exceptions.RequestError:TransportError(400,'parsing_exception','没有[查询]注册[filtered]')

@randomlock
Copy link

Any update on this ?

@geert2705
Copy link

elasticsearch 5.6.16, using haystack master as suggested but still
TransportError(400, 'parsing_exception', 'no [query] registered for [filtered]')

@isakbosman
Copy link

Make sure that your HAYSTACK_CONNECTIONS settings has ENGINE: 'search.backends.elasticsearch5_backend.Elasticsearch5SearchEngine' I somehow missed this in the documentation if its in there and it resolved my issues

@mverleg
Copy link

mverleg commented Jun 16, 2020

Suggestion by @isakbosman worked for me (along with installing elasticsearch>=5.0.0,<6.0.0). I tested using master code. Tried latest pip version but was blocked by #1732.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests