Skip to content

Commit ae47c02

Browse files
authored
add basic REST test for geohash_grid (#37996)
1 parent f2dd5dd commit ae47c02

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
setup:
2+
- do:
3+
indices.create:
4+
include_type_name: false
5+
index: test_1
6+
body:
7+
settings:
8+
number_of_replicas: 0
9+
mappings:
10+
properties:
11+
location:
12+
type: geo_point
13+
14+
---
15+
"Basic test":
16+
- do:
17+
bulk:
18+
refresh: true
19+
body:
20+
- index:
21+
_index: test_1
22+
_id: 1
23+
- location: "52.374081,4.912350"
24+
- index:
25+
_index: test_1
26+
_id: 2
27+
- location: "52.369219,4.901618"
28+
- index:
29+
_index: test_1
30+
_id: 3
31+
- location: "52.371667,4.914722"
32+
- index:
33+
_index: test_1
34+
_id: 4
35+
- location: "51.222900,4.405200"
36+
- index:
37+
_index: test_1
38+
_id: 5
39+
- location: "48.861111,2.336389"
40+
- index:
41+
_index: test_1
42+
_id: 6
43+
- location: "48.860000,2.327000"
44+
45+
- do:
46+
search:
47+
rest_total_hits_as_int: true
48+
body:
49+
aggregations:
50+
grid:
51+
geohash_grid:
52+
field: location
53+
precision: 3
54+
55+
56+
- match: { hits.total: 6 }
57+
- match: { aggregations.grid.buckets.0.key: u17 }
58+
- match: { aggregations.grid.buckets.0.doc_count: 3 }
59+
- match: { aggregations.grid.buckets.1.key: u09 }
60+
- match: { aggregations.grid.buckets.1.doc_count: 2 }
61+
- match: { aggregations.grid.buckets.2.key: u15 }
62+
- match: { aggregations.grid.buckets.2.doc_count: 1 }

0 commit comments

Comments
 (0)