Skip to content

Commit

Permalink
Use Elasticsearch 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
patrys committed Oct 30, 2018
1 parent baeefb8 commit 44aba0d
Show file tree
Hide file tree
Showing 15 changed files with 1,450 additions and 34 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ RUN \
# Install Python dependencies
RUN pip install pipenv
ADD Pipfile /app/
ADD Pipfile.lock /app/
WORKDIR /app
RUN pipenv install --system --deploy --dev --skip-lock
RUN pipenv install --system --deploy --dev

### Build static assets
FROM node:10 as build-nodejs
Expand Down
6 changes: 3 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ django-templated-email = ">=2.2.0"
django-versatileimagefield = ">=1.10"
django-webpack-loader = ">=0.3.0"
django-celery-results = "*"
django-elasticsearch-dsl = "*"
django-elasticsearch-dsl = ">=0.5.0.<0.6.0"
django-recaptcha = "*"
django-silk = "==2.0.0"
django-debug-toolbar = "*"
django-debug-toolbar-request-history = "*"
elasticsearch = ">=5.4,<6.0.0"
elasticsearch-dsl = ">=5.0.0,<6.0.0"
elasticsearch = ">=6.0.0,<6.1.0"
elasticsearch-dsl = ">=6.0.0,<6.1.0"
faker = ">=0.7.7"
freezegun = ">=0.3.9"
google-measurement-protocol = ">=1.0.0"
Expand Down
1,411 changes: 1,411 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ services:
- redis

search:
image: elasticsearch:5.4.3
image: elasticsearch:6.4.2
restart: unless-stopped
networks:
- saleor-backend-tier
Expand All @@ -70,7 +70,7 @@ services:
# See https://github.com/docker/compose/issues/4513 if updating to version '3'
mem_limit: 512m
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m -Dlog4j2.disable.jmx=true"

volumes:
saleor-db:
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ django-versatileimagefield==1.10
django-webpack-loader==0.6.0
django==2.1.2
docutils==0.14
elasticsearch-dsl==5.4.0
elasticsearch==5.5.3
elasticsearch-dsl==6.0.1
elasticsearch==6.0.0
faker==0.9.1
freezegun==0.3.10
google-i18n-address==2.3.2
Expand Down
2 changes: 1 addition & 1 deletion saleor/search/backends/test_elasticsearch_storefront.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PHRASE = 'How fortunate man with none'
FIELDS = ['title', 'name', 'description']
INDEX = 'storefront'
DOC_TYPE = 'product_document'
DOC_TYPE = 'doc'
QUERY = {
'_source': False,
'query': {
Expand Down
10 changes: 5 additions & 5 deletions tests/cassettes/test_dashboard_search_orders_by_user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/storefront/product_document/_search
uri: http://search:9200/storefront/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand All @@ -22,9 +22,9 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/orders/order_document/_search
uri: http://search:9200/orders/doc/_search
response:
body: {string: '{"took":2,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":2,"max_score":2.1282318,"hits":[{"_index":"orders","_type":"order_document","_id":"19","_score":2.1282318,"_source":{}},{"_index":"orders","_type":"order_document","_id":"18","_score":2.1282318,"_source":{}}]}}'}
body: {string: '{"took":2,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":2,"max_score":2.1282318,"hits":[{"_index":"orders","_type":"doc","_id":"19","_score":2.1282318,"_source":{}},{"_index":"orders","_type":"doc","_id":"18","_score":2.1282318,"_source":{}}]}}'}
headers:
Warning: ['299 Elasticsearch-5.4.3-eed30a8 "Deprecated field [exclude] used,
expected [excludes] instead" "Thu, 16 Nov 2017 09:44:26 GMT"']
Expand All @@ -39,9 +39,9 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/users/user_document/_search
uri: http://search:9200/users/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":1,"max_score":5.115776,"hits":[{"_index":"users","_type":"user_document","_id":"17","_score":5.115776,"_source":{}}]}}'}
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":1,"max_score":5.115776,"hits":[{"_index":"users","_type":"doc","_id":"17","_score":5.115776,"_source":{}}]}}'}
headers:
Warning: ['299 Elasticsearch-5.4.3-eed30a8 "Deprecated field [exclude] used,
expected [excludes] instead" "Thu, 16 Nov 2017 09:44:26 GMT"']
Expand Down
8 changes: 4 additions & 4 deletions tests/cassettes/test_dashboard_search_user_by_email.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/storefront/product_document/_search
uri: http://search:9200/storefront/doc/_search
response:
body: {string: '{"took":0,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand All @@ -22,7 +22,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/orders/order_document/_search
uri: http://search:9200/orders/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand All @@ -39,9 +39,9 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/users/user_document/_search
uri: http://search:9200/users/doc/_search
response:
body: {string: '{"took":3,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":1,"max_score":5.115776,"hits":[{"_index":"users","_type":"user_document","_id":"9","_score":5.115776,"_source":{}}]}}'}
body: {string: '{"took":3,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":1,"max_score":5.115776,"hits":[{"_index":"users","_type":"doc","_id":"9","_score":5.115776,"_source":{}}]}}'}
headers:
Warning: ['299 Elasticsearch-5.4.3-eed30a8 "Deprecated field [exclude] used,
expected [excludes] instead" "Thu, 16 Nov 2017 09:44:26 GMT"']
Expand Down
8 changes: 4 additions & 4 deletions tests/cassettes/test_dashboard_search_user_name.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/orders/order_document/_search
uri: http://search:9200/orders/doc/_search
response:
body: {string: '{"took":0,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand All @@ -22,7 +22,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/storefront/product_document/_search
uri: http://search:9200/storefront/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand All @@ -39,9 +39,9 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/users/user_document/_search
uri: http://search:9200/users/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":1,"max_score":2.6855774,"hits":[{"_index":"users","_type":"user_document","_id":"6","_score":2.6855774,"_source":{}}]}}'}
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":1,"max_score":2.6855774,"hits":[{"_index":"users","_type":"doc","_id":"6","_score":2.6855774,"_source":{}}]}}'}
headers:
Warning: ['299 Elasticsearch-5.4.3-eed30a8 "Deprecated field [exclude] used,
expected [excludes] instead" "Thu, 16 Nov 2017 09:37:53 GMT"']
Expand Down
6 changes: 3 additions & 3 deletions tests/cassettes/test_dashboard_search_with_empty_results.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/storefront/product_document/_search
uri: http://search:9200/storefront/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand All @@ -22,7 +22,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/orders/order_document/_search
uri: http://search:9200/orders/doc/_search
response:
body: {string: '{"took":0,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand All @@ -39,7 +39,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/users/user_document/_search
uri: http://search:9200/users/doc/_search
response:
body: {string: '{"took":3,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/storefront/product_document/_search
uri: http://search:9200/storefront/doc/_search
response:
body: {string: '{"took":2,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":3,"max_score":2.9128819,"hits":[{"_index":"storefront","_type":"product_document","_id":"23","_score":2.9128819,"_source":{}},{"_index":"storefront","_type":"product_document","_id":"58","_score":2.9128819,"_source":{}},{"_index":"storefront","_type":"product_document","_id":"56","_score":2.9128819,"_source":{}}]}}'}
body: {string: '{"took":2,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":3,"max_score":2.9128819,"hits":[{"_index":"storefront","_type":"doc","_id":"23","_score":2.9128819,"_source":{}},{"_index":"storefront","_type":"doc","_id":"58","_score":2.9128819,"_source":{}},{"_index":"storefront","_type":"doc","_id":"56","_score":2.9128819,"_source":{}}]}}'}
headers:
Warning: ['299 Elasticsearch-5.4.3-eed30a8 "Deprecated field [exclude] used,
expected [excludes] instead" "Thu, 16 Nov 2017 09:44:25 GMT"']
Expand All @@ -22,7 +22,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/orders/order_document/_search
uri: http://search:9200/orders/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand All @@ -39,7 +39,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/users/user_document/_search
uri: http://search:9200/users/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand Down
4 changes: 2 additions & 2 deletions tests/cassettes/test_new_search_doesnt_show_unpublished.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/storefront/product_document/_search
uri: http://search:9200/storefront/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":2,"max_score":3.223138,"hits":[{"_index":"storefront","_type":"product_document","_id":"15","_score":3.223138},{"_index":"storefront","_type":"product_document","_id":"56","_score":3.223138}]}}'}
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":2,"max_score":3.223138,"hits":[{"_index":"storefront","_type":"doc","_id":"15","_score":3.223138},{"_index":"storefront","_type":"doc","_id":"56","_score":3.223138}]}}'}
headers:
content-length: ['285']
content-type: [application/json; charset=UTF-8]
Expand Down
2 changes: 1 addition & 1 deletion tests/cassettes/test_new_search_with_empty_results.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/storefront/product_document/_search
uri: http://search:9200/storefront/doc/_search
response:
body: {string: '{"took":0,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
headers:
Expand Down
4 changes: 2 additions & 2 deletions tests/cassettes/test_new_search_with_result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interactions:
connection: [keep-alive]
content-type: [application/json]
method: GET
uri: http://search:9200/storefront/product_document/_search
uri: http://search:9200/storefront/doc/_search
response:
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":2,"max_score":3.223138,"hits":[{"_index":"storefront","_type":"product_document","_id":"15","_score":3.223138},{"_index":"storefront","_type":"product_document","_id":"56","_score":3.223138}]}}'}
body: {string: '{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hits":{"total":2,"max_score":3.223138,"hits":[{"_index":"storefront","_type":"doc","_id":"15","_score":3.223138},{"_index":"storefront","_type":"doc","_id":"56","_score":3.223138}]}}'}
headers:
content-length: ['285']
content-type: [application/json; charset=UTF-8]
Expand Down
4 changes: 4 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

LANGUAGE_CODE = 'en'

ES_URL = None
SEARCH_BACKEND = 'saleor.search.backends.postgresql'
INSTALLED_APPS = [a for a in INSTALLED_APPS if a != 'django_elasticsearch_dsl']

RECAPTCHA_PUBLIC_KEY = None
RECAPTCHA_PRIVATE_KEY = None

Expand Down

0 comments on commit 44aba0d

Please sign in to comment.