Skip to content

Commit

Permalink
Merge django-haystack#1460: backend support for Elasticsearch 2.x
Browse files Browse the repository at this point in the history
Thanks to João Junior (@joaojunior) and Bruno Marques (@ElSaico) for the
patch

Closes django-haystack#1460
Closes django-haystack#1391
Closes django-haystack#1336
Closes django-haystack#1247
  • Loading branch information
acdha committed Jan 2, 2017
2 parents 176bc54 + 8712d89 commit f8921b6
Show file tree
Hide file tree
Showing 15 changed files with 2,362 additions and 42 deletions.
28 changes: 20 additions & 8 deletions .travis.yml
@@ -1,4 +1,4 @@
sudo: false
sudo: true
language: python
python:
- 2.7
Expand Down Expand Up @@ -26,10 +26,22 @@ addons:

before_install:
- mkdir -p $HOME/download-cache
# See https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-repo
- wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
- >
if [[ $VERSION_ES == '>=2.0.0,<3.0.0' ]];
then
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
else
echo "deb http://packages.elastic.co/elasticsearch/1.7/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-1.7.list
fi
- sudo apt-get update
- sudo apt-get -y install elasticsearch
- sudo service elasticsearch restart

install:
- pip install --upgrade setuptools
- pip install requests "Django${DJANGO_VERSION}"
- pip install requests "Django${DJANGO_VERSION}" "elasticsearch${VERSION_ES}"
- python setup.py clean build install

before_script:
Expand All @@ -41,17 +53,17 @@ script:

env:
matrix:
- DJANGO_VERSION=">=1.8,<1.9"
- DJANGO_VERSION=">=1.9,<1.10"
- DJANGO_VERSION=">=1.10,<1.11"
- DJANGO_VERSION=">=1.8,<1.9" VERSION_ES=">=1.0.0,<2.0.0"
- DJANGO_VERSION=">=1.9,<1.10" VERSION_ES=">=1.0.0,<2.0.0"
- DJANGO_VERSION=">=1.10,<1.11" VERSION_ES=">=1.0.0,<2.0.0"
- DJANGO_VERSION=">=1.8,<1.9" VERSION_ES=">=2.0.0,<3.0.0"
- DJANGO_VERSION=">=1.9,<1.10" VERSION_ES=">=2.0.0,<3.0.0"
- DJANGO_VERSION=">=1.10,<1.11" VERSION_ES=">=2.0.0,<3.0.0"

matrix:
allow_failures:
- python: 'pypy'

services:
- elasticsearch

notifications:
irc: "irc.freenode.org#haystack"
email: false
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -115,3 +115,4 @@ Thanks to
* Tim Babych (@tymofij) for enabling backend-specific parameters in ``.highlight()``
* Antony Raj (@antonyr) for adding endswith input type and fixing contains input type
* Morgan Aubert (@ellmetha) for Django 1.10 support
* João Junior (@joaojunior) and Bruno Marques (@ElSaico) for Elasticsearch 2.x support
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -10,7 +10,7 @@ API that allows you to plug in different search backends (such as Solr_,
Elasticsearch_, Whoosh_, Xapian_, etc.) without having to modify your code.

.. _Solr: http://lucene.apache.org/solr/
.. _Elasticsearch: http://elasticsearch.org/
.. _Elasticsearch: https://www.elastic.co/products/elasticsearch
.. _Whoosh: https://bitbucket.org/mchaput/whoosh/
.. _Xapian: http://xapian.org/

Expand Down
2 changes: 1 addition & 1 deletion docs/backend_support.rst
Expand Up @@ -50,7 +50,7 @@ Elasticsearch
* Stored (non-indexed) fields
* Highlighting
* Spatial search
* Requires: elasticsearch-py > 1.0 & Elasticsearch 1.0+ (Neither Elasticsearch 2.X `#1247 <https://github.com/django-haystack/django-haystack/issues/1247>`_ nor Elasticsearch 5.X `#1383 <https://github.com/django-haystack/django-haystack/issues/1383>`_ are supported yet.)
* Requires: `elasticsearch <https://pypi.python.org/pypi/elasticsearch>`_ 1.x or 2.x. Elasticsearch 5.X is currently unsupported: see `#1383 <https://github.com/django-haystack/django-haystack/issues/1383>`_.

Whoosh
------
Expand Down
6 changes: 3 additions & 3 deletions docs/installing_search_engines.rst
Expand Up @@ -114,9 +114,9 @@ Official Download Location: http://www.elasticsearch.org/download/

Elasticsearch is Java but comes in a pre-packaged form that requires very
little other than the JRE. It's also very performant, scales easily and has
an advanced featureset. Haystack currently only supports ElasticSearch 1.x.
ElasticSearch 2.x is not supported yet, if you would like to help, please see
`#1247 <https://github.com/django-haystack/django-haystack/issues/1247>`_.
an advanced featureset. Haystack currently only supports Elasticsearch 1.x and 2.x.
Elasticsearch 5.x is not supported yet, if you would like to help, please see
`#1383 <https://github.com/django-haystack/django-haystack/issues/1383>`_.

Installation is best done using a package manager::

Expand Down
2 changes: 1 addition & 1 deletion docs/searchqueryset_api.rst
Expand Up @@ -304,7 +304,7 @@ Example::

# For SOLR (setting f.author.facet.*; see http://wiki.apache.org/solr/SimpleFacetParameters#Parameters)
SearchQuerySet().facet('author', mincount=1, limit=10)
# For ElasticSearch (see http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet.html)
# For Elasticsearch (see http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet.html)
SearchQuerySet().facet('author', size=10, order='term')

In the search results you get back, facet counts will be populated in the
Expand Down

0 comments on commit f8921b6

Please sign in to comment.