From f378596e257ff6c50516beee2cb218a0f900db31 Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Tue, 29 Jan 2019 14:53:49 -0800 Subject: [PATCH 1/2] add basic REST test for geohash_grid --- .../search.aggregation/280_geohash_grid.yml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/280_geohash_grid.yml diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/280_geohash_grid.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/280_geohash_grid.yml new file mode 100644 index 0000000000000..14eaa0dea582c --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/280_geohash_grid.yml @@ -0,0 +1,68 @@ +setup: + - do: + indices.create: + index: test_1 + body: + settings: + number_of_replicas: 0 + mappings: + _doc: + properties: + location: + type: geo_point + +--- +"Basic test": + - do: + bulk: + refresh: true + body: + - index: + _index: test_1 + _type: _doc + _id: 1 + - location: "52.374081,4.912350" + - index: + _index: test_1 + _type: _doc + _id: 2 + - location: "52.369219,4.901618" + - index: + _index: test_1 + _type: _doc + _id: 3 + - location: "52.371667,4.914722" + - index: + _index: test_1 + _type: _doc + _id: 4 + - location: "51.222900,4.405200" + - index: + _index: test_1 + _type: _doc + _id: 5 + - location: "48.861111,2.336389" + - index: + _index: test_1 + _type: _doc + _id: 6 + - location: "48.860000,2.327000" + + - do: + search: + rest_total_hits_as_int: true + body: + aggregations: + grid: + geohash_grid: + field: location + precision: 3 + + + - match: { hits.total: 6 } + - match: { aggregations.grid.buckets.0.key: u17 } + - match: { aggregations.grid.buckets.0.doc_count: 3 } + - match: { aggregations.grid.buckets.1.key: u09 } + - match: { aggregations.grid.buckets.1.doc_count: 2 } + - match: { aggregations.grid.buckets.2.key: u15 } + - match: { aggregations.grid.buckets.2.doc_count: 1 } From 618566c132fd67ec75fa06fe456388a8a5a1d6e1 Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Tue, 29 Jan 2019 16:54:55 -0800 Subject: [PATCH 2/2] type removal --- .../search.aggregation/280_geohash_grid.yml | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/280_geohash_grid.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/280_geohash_grid.yml index 14eaa0dea582c..534e552fc0ea2 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/280_geohash_grid.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/280_geohash_grid.yml @@ -1,15 +1,15 @@ setup: - do: indices.create: - index: test_1 - body: - settings: - number_of_replicas: 0 - mappings: - _doc: - properties: - location: - type: geo_point + include_type_name: false + index: test_1 + body: + settings: + number_of_replicas: 0 + mappings: + properties: + location: + type: geo_point --- "Basic test": @@ -19,32 +19,26 @@ setup: body: - index: _index: test_1 - _type: _doc _id: 1 - location: "52.374081,4.912350" - index: _index: test_1 - _type: _doc _id: 2 - location: "52.369219,4.901618" - index: _index: test_1 - _type: _doc _id: 3 - location: "52.371667,4.914722" - index: _index: test_1 - _type: _doc _id: 4 - location: "51.222900,4.405200" - index: _index: test_1 - _type: _doc _id: 5 - location: "48.861111,2.336389" - index: _index: test_1 - _type: _doc _id: 6 - location: "48.860000,2.327000"