Skip to content

Commit

Permalink
add basic REST test for geohash_grid (#37996)
Browse files Browse the repository at this point in the history
  • Loading branch information
talevy committed Feb 5, 2019
1 parent f2dd5dd commit ae47c02
Showing 1 changed file with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 }

0 comments on commit ae47c02

Please sign in to comment.