From db800f42a1fb2a65475e8f86a8adafa3263ac62a Mon Sep 17 00:00:00 2001 From: Hugo Rodger-Brown Date: Thu, 3 Sep 2020 17:22:51 +0100 Subject: [PATCH 1/6] Add support for the "boxplot" aggregation This commit adds a new Agg subclass called BoxPlot, which passes the name "boxplot" as the aggregation type. See https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-aggregations-metrics-boxplot-aggregation.html#_syntax --- elasticsearch_dsl/aggs.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/elasticsearch_dsl/aggs.py b/elasticsearch_dsl/aggs.py index 547a5931a..a709d6dd6 100644 --- a/elasticsearch_dsl/aggs.py +++ b/elasticsearch_dsl/aggs.py @@ -298,6 +298,10 @@ class WeightedAvg(Agg): name = "weighted_avg" +class BoxPlot(Agg): + name = "boxplot" + + class Cardinality(Agg): name = "cardinality" From 9d97fe181fe05f9a90b35912f6d59713d0bea200 Mon Sep 17 00:00:00 2001 From: Hugo Rodger-Brown Date: Thu, 3 Sep 2020 21:35:36 +0100 Subject: [PATCH 2/6] Empty commit for force CI For some reason the cla-checker-service hasn't picked up my CLA, so I'm pushing a new commit in the hope that it triggers the check again. From fa5492c9c90843ceee3017cc703d6cefb22ab051 Mon Sep 17 00:00:00 2001 From: Hugo Rodger-Brown Date: Thu, 3 Sep 2020 21:49:41 +0100 Subject: [PATCH 3/6] Fix Black issues Black has updated some rules around how trailing commas are dealt with in wrapping of lists. --- elasticsearch_dsl/index.py | 2 +- elasticsearch_dsl/utils.py | 2 +- .../test_integration/test_document.py | 2 +- test_elasticsearch_dsl/test_search.py | 19 ++++++++----------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/elasticsearch_dsl/index.py b/elasticsearch_dsl/index.py index 6712a6ba8..a9a70dd15 100644 --- a/elasticsearch_dsl/index.py +++ b/elasticsearch_dsl/index.py @@ -264,7 +264,7 @@ def updateByQuery(self, using=None): For more information, see here: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html """ - return UpdateByQuery(using=using or self._using, index=self._name,) + return UpdateByQuery(using=using or self._using, index=self._name) def create(self, using=None, **kwargs): """ diff --git a/elasticsearch_dsl/utils.py b/elasticsearch_dsl/utils.py index c989302b0..a12e299db 100644 --- a/elasticsearch_dsl/utils.py +++ b/elasticsearch_dsl/utils.py @@ -32,7 +32,7 @@ SKIP_VALUES = ("", None) EXPAND__TO_DOT = True -DOC_META_FIELDS = frozenset(("id", "routing",)) +DOC_META_FIELDS = frozenset(("id", "routing")) META_FIELDS = frozenset( ( diff --git a/test_elasticsearch_dsl/test_integration/test_document.py b/test_elasticsearch_dsl/test_integration/test_document.py index 99b5d5386..968bf92ea 100644 --- a/test_elasticsearch_dsl/test_integration/test_document.py +++ b/test_elasticsearch_dsl/test_integration/test_document.py @@ -437,7 +437,7 @@ def test_delete(write_client): test_repo.meta.index = "test-document" test_repo.delete() - assert not write_client.exists(index="test-document", id="elasticsearch-dsl-py",) + assert not write_client.exists(index="test-document", id="elasticsearch-dsl-py") def test_search(data_client): diff --git a/test_elasticsearch_dsl/test_search.py b/test_elasticsearch_dsl/test_search.py index 8035aa15a..f0c62af01 100644 --- a/test_elasticsearch_dsl/test_search.py +++ b/test_elasticsearch_dsl/test_search.py @@ -429,17 +429,14 @@ def test_source(): def test_source_on_clone(): - assert ( - { - "_source": {"includes": ["foo.bar.*"], "excludes": ["foo.one"]}, - "query": {"bool": {"filter": [{"term": {"title": "python"}}]}}, - } - == search.Search() - .source(includes=["foo.bar.*"]) - .source(excludes=["foo.one"]) - .filter("term", title="python") - .to_dict() - ) + assert { + "_source": {"includes": ["foo.bar.*"], "excludes": ["foo.one"]}, + "query": {"bool": {"filter": [{"term": {"title": "python"}}]}}, + } == search.Search().source(includes=["foo.bar.*"]).source( + excludes=["foo.one"] + ).filter( + "term", title="python" + ).to_dict() assert { "_source": False, "query": {"bool": {"filter": [{"term": {"title": "python"}}]}}, From 144d9ec84e1c1a6e14900e5cbd37e4f67c6439f8 Mon Sep 17 00:00:00 2001 From: Hugo Rodger-Brown Date: Thu, 3 Sep 2020 22:04:51 +0100 Subject: [PATCH 4/6] Remove standard token filter from test snowball analyzer. The standard token filter was a noop in 6.x and has been removed in 7.x --- test_elasticsearch_dsl/test_integration/test_document.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_elasticsearch_dsl/test_integration/test_document.py b/test_elasticsearch_dsl/test_integration/test_document.py index 968bf92ea..214a664b2 100644 --- a/test_elasticsearch_dsl/test_integration/test_document.py +++ b/test_elasticsearch_dsl/test_integration/test_document.py @@ -44,7 +44,7 @@ from pytest import raises snowball = analyzer( - "my_snow", tokenizer="standard", filter=["standard", "lowercase", "snowball"] + "my_snow", tokenizer="standard", filter=["lowercase", "snowball"] ) From f6744e560c3f20191becd40b3f72f84c9cbef284 Mon Sep 17 00:00:00 2001 From: Hugo Rodger-Brown Date: Thu, 3 Sep 2020 22:09:19 +0100 Subject: [PATCH 5/6] Fix Black formatting issue --- test_elasticsearch_dsl/test_integration/test_document.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test_elasticsearch_dsl/test_integration/test_document.py b/test_elasticsearch_dsl/test_integration/test_document.py index 214a664b2..7e0404b75 100644 --- a/test_elasticsearch_dsl/test_integration/test_document.py +++ b/test_elasticsearch_dsl/test_integration/test_document.py @@ -43,9 +43,7 @@ from pytest import raises -snowball = analyzer( - "my_snow", tokenizer="standard", filter=["lowercase", "snowball"] -) +snowball = analyzer("my_snow", tokenizer="standard", filter=["lowercase", "snowball"]) class User(InnerDoc): From b7ea1c46ac872173288ee8210be8964d0c903e95 Mon Sep 17 00:00:00 2001 From: Hugo Rodger-Brown Date: Thu, 3 Sep 2020 22:17:07 +0100 Subject: [PATCH 6/6] All "nightly" to fail travis build It's curently failing because of a dependency issue in coverage that has nothing to do with this project. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index c466f7f09..f23015148 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,8 @@ matrix: - python -m pip install nox script: - nox -s lint + allow_failures: + - { python: "nightly" } install: - mkdir /tmp/elasticsearch