--- setup: - do: indices.create: index: test body: mappings: properties: date: type: date keyword: type: keyword long: type: long geo_point: type: geo_point nested: type: nested properties: nested_long: type: long - do: indices.create: index: other body: mappings: properties: date: type: date long: type: long nested: type: nested properties: nested_long: type: long - do: index: index: test id: 1 body: { "keyword": "foo", "long": [10, 20], "geo_point": "37.2343,-115.8067", "nested": [{"nested_long": 10}, {"nested_long": 20}] } - do: index: index: test id: 2 body: { "keyword": ["foo", "bar"], "geo_point": "41.12,-71.34" } - do: index: index: test id: 3 body: { "keyword": "bar", "long": [100, 0], "geo_point": "90.0,0.0", "nested": [{"nested_long": 10}, {"nested_long": 0}] } - do: index: index: test id: 4 body: { "keyword": "bar", "long": [1000, 0], "geo_point": "41.12,-71.34", "nested": [{"nested_long": 1000}, {"nested_long": 20}] } - do: index: index: test id: 5 body: { "date": "2017-10-20T03:08:45" } - do: index: index: test id: 6 body: { "date": "2017-10-21T07:00:00" } - do: index: index: other id: 0 body: { "date": "2017-10-20T03:08:45" } - do: indices.refresh: index: [test, other] --- "Simple Composite aggregation with GeoTile grid": - skip: version: " - 7.4.99" reason: geotile_grid is not supported until 7.5.0 - do: search: rest_total_hits_as_int: true index: test body: aggregations: test: composite: sources: [ "geo": { "geotile_grid": { "field": "geo_point", "precision": 12 } }, { "kw": { "terms": { "field": "keyword" } } } ] - match: {hits.total: 6} - length: { aggregations.test.buckets: 4 } - match: { aggregations.test.buckets.0.key.geo: "12/730/1590" } - match: { aggregations.test.buckets.0.key.kw: "foo" } - match: { aggregations.test.buckets.0.doc_count: 1 } - match: { aggregations.test.buckets.1.key.geo: "12/1236/1533" } - match: { aggregations.test.buckets.1.key.kw: "bar" } - match: { aggregations.test.buckets.1.doc_count: 2 } - match: { aggregations.test.buckets.2.key.geo: "12/1236/1533" } - match: { aggregations.test.buckets.2.key.kw: "foo" } - match: { aggregations.test.buckets.2.doc_count: 1 } - match: { aggregations.test.buckets.3.key.geo: "12/2048/0" } - match: { aggregations.test.buckets.3.key.kw: "bar" } - match: { aggregations.test.buckets.3.doc_count: 1 } --- "Simple Composite aggregation with geotile grid add aggregate after": - skip: version: " - 7.4.99" reason: geotile_grid is not supported until 7.5.0 - do: search: index: test body: aggregations: test: composite: sources: [ "geo": { "geotile_grid": { "field": "geo_point", "precision": 12 } }, { "kw": { "terms": { "field": "keyword" } } } ] after: { "geo": "12/730/1590", "kw": "foo" } - match: { hits.total.value: 6 } - match: { hits.total.relation: "eq" } - length: { aggregations.test.buckets: 3 } - match: { aggregations.test.buckets.0.key.geo: "12/1236/1533" } - match: { aggregations.test.buckets.0.key.kw: "bar" } - match: { aggregations.test.buckets.0.doc_count: 2 } - match: { aggregations.test.buckets.1.key.geo: "12/1236/1533" } - match: { aggregations.test.buckets.1.key.kw: "foo" } - match: { aggregations.test.buckets.1.doc_count: 1 } - match: { aggregations.test.buckets.2.key.geo: "12/2048/0" } - match: { aggregations.test.buckets.2.key.kw: "bar" } - match: { aggregations.test.buckets.2.doc_count: 1 }