django-haystack / django-haystack/django-haystack

Haystack causes a "list of nodes should not include schema" warning in elasticsearch

Open
#1,109 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backend : elasticsearch needs review
Dominant language
Python
Stars
3.7k
Forks
1.3k
Avg merge
3h 18m
Merged PRs (30d)
3

Description

I'm working on a Django app. It has a settings.py that configures Haystack to use elasticsearch as per the example in http://django-haystack.readthedocs.org/en/latest/tutorial.html#elasticsearch:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',  # noqa pylint: disable=line-too-long
        'URL': 'http://%s:%s/' % (
             # get port mappings from Docker
             os.environ['ELASTICSEARCH_PORT_9200_TCP_ADDR'],
             os.environ['ELASTICSEARCH_PORT_9200_TCP_PORT'],
        ),

This causes a warning to be emitted in elasticsearch.client._normalize_hosts:

WARNING elasticsearch 38 List of nodes should not include schema information (http://): u'http://0.0.0.0:49204 '. null

It seems that elasticsearch (I've got version 1.2.0 here) wants a simple hostname:port instead of a full URL.

I don't know if you want to fix this in haystack.backends.elasticsearch_backend or if you want to change the documentation. Actually, changing the documentation feels wrong: if the setting is named URL, it should be able to handle URLs without emitting warnings.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with haystack/backends/elasticsearch_backend.py and compare its URL handling with elasticsearch.client._normalize_hosts, using the configuration and warning shown in the issue. Check whether the documented URL setting or the backend integration is responsible, then verify that the warning no longer appears while the documented Elasticsearch connection still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, elasticsearch, python
Domain
backend, search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.