Skip to content

Commit f8921b6

Browse files
committed
Merge django-haystack#1460: backend support for Elasticsearch 2.x
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
2 parents 176bc54 + 8712d89 commit f8921b6

File tree

15 files changed

+2362
-42
lines changed

15 files changed

+2362
-42
lines changed

.travis.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sudo: false
1+
sudo: true
22
language: python
33
python:
44
- 2.7
@@ -26,10 +26,22 @@ addons:
2626

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

3042
install:
3143
- pip install --upgrade setuptools
32-
- pip install requests "Django${DJANGO_VERSION}"
44+
- pip install requests "Django${DJANGO_VERSION}" "elasticsearch${VERSION_ES}"
3345
- python setup.py clean build install
3446

3547
before_script:
@@ -41,17 +53,17 @@ script:
4153

4254
env:
4355
matrix:
44-
- DJANGO_VERSION=">=1.8,<1.9"
45-
- DJANGO_VERSION=">=1.9,<1.10"
46-
- DJANGO_VERSION=">=1.10,<1.11"
56+
- DJANGO_VERSION=">=1.8,<1.9" VERSION_ES=">=1.0.0,<2.0.0"
57+
- DJANGO_VERSION=">=1.9,<1.10" VERSION_ES=">=1.0.0,<2.0.0"
58+
- DJANGO_VERSION=">=1.10,<1.11" VERSION_ES=">=1.0.0,<2.0.0"
59+
- DJANGO_VERSION=">=1.8,<1.9" VERSION_ES=">=2.0.0,<3.0.0"
60+
- DJANGO_VERSION=">=1.9,<1.10" VERSION_ES=">=2.0.0,<3.0.0"
61+
- DJANGO_VERSION=">=1.10,<1.11" VERSION_ES=">=2.0.0,<3.0.0"
4762

4863
matrix:
4964
allow_failures:
5065
- python: 'pypy'
5166

52-
services:
53-
- elasticsearch
54-
5567
notifications:
5668
irc: "irc.freenode.org#haystack"
5769
email: false

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,4 @@ Thanks to
115115
* Tim Babych (@tymofij) for enabling backend-specific parameters in ``.highlight()``
116116
* Antony Raj (@antonyr) for adding endswith input type and fixing contains input type
117117
* Morgan Aubert (@ellmetha) for Django 1.10 support
118+
* João Junior (@joaojunior) and Bruno Marques (@ElSaico) for Elasticsearch 2.x support

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ API that allows you to plug in different search backends (such as Solr_,
1010
Elasticsearch_, Whoosh_, Xapian_, etc.) without having to modify your code.
1111

1212
.. _Solr: http://lucene.apache.org/solr/
13-
.. _Elasticsearch: http://elasticsearch.org/
13+
.. _Elasticsearch: https://www.elastic.co/products/elasticsearch
1414
.. _Whoosh: https://bitbucket.org/mchaput/whoosh/
1515
.. _Xapian: http://xapian.org/
1616

docs/backend_support.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Elasticsearch
5050
* Stored (non-indexed) fields
5151
* Highlighting
5252
* Spatial search
53-
* 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.)
53+
* 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>`_.
5454

5555
Whoosh
5656
------

docs/installing_search_engines.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ Official Download Location: http://www.elasticsearch.org/download/
114114

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

121121
Installation is best done using a package manager::
122122

docs/searchqueryset_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ Example::
304304

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

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

0 commit comments

Comments
 (0)