add basic REST test for geohash_grid (#37996)

This commit is contained in:
Tal Levy 2019-02-05 09:44:47 -08:00 committed by GitHub
parent f2dd5dd6eb
commit ae47c025e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,62 @@
setup:
- do:
indices.create:
include_type_name: false
index: test_1
body:
settings:
number_of_replicas: 0
mappings:
properties:
location:
type: geo_point
---
"Basic test":
- do:
bulk:
refresh: true
body:
- index:
_index: test_1
_id: 1
- location: "52.374081,4.912350"
- index:
_index: test_1
_id: 2
- location: "52.369219,4.901618"
- index:
_index: test_1
_id: 3
- location: "52.371667,4.914722"
- index:
_index: test_1
_id: 4
- location: "51.222900,4.405200"
- index:
_index: test_1
_id: 5
- location: "48.861111,2.336389"
- index:
_index: test_1
_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 }