1. Corresponding entity in Java
public class Person { String name; int age; }
2. Data in kibana
{ "_index": "person_index", "_type": "person_type", "_id": "i674x3IBsOhWggMeikEo", "_score": 1, "_source": { "age": 9, "name": "Li Si" } }, { "_index": "person_index", "_type": "person_type", "_id": "jq74x3IBsOhWggMeikGu", "_score": 1, "_source": { "age": 63, "name": "Hou Qi" } }, { "_index": "person_index", "_type": "person_type", "_id": "ja74x3IBsOhWggMeikGD", "_score": 1, "_source": { "age": 41, "name": "Malacca" } }, { "_index": "person_index", "_type": "person_type", "_id": "j674x3IBsOhWggMeikHH", "_score": 1, "_source": { "age": 452, "name": "Zhao Ba" } }, { "_index": "person_index", "_type": "person_type", "_id": "iq74x3IBsOhWggMeiUGi", "_score": 1, "_source": { "age": 16, "name": "Zhang San" } }, { "_index": "person_index", "_type": "person_type", "_id": "jK74x3IBsOhWggMeikFX", "_score": 1, "_source": { "age": 32, "name": "King Five" } }, { "_index": "person_index", "_type": "person_type", "_id": "kK74x3IBsOhWggMeikHU", "_score": 1, "_source": { "age": 32, "name": "Sun Jiu" } }, { "_index": "person_index", "_type": "person_type", "_id": "ka74x3IBsOhWggMeikHg", "_score": 1, "_source": { "age": -8, "name": "Semen Typhonii" } }
3.kibana search
You can see that the hits in the first layer represent parameters that hit the result based on the request criteria, such as total, max_score.
Hits in hits is a collection of hits, which contains the index of each result, the type, and so on. source is the value of the object.
4. Aggregate results
The above json search condition is to first search for a group by less than 60 years of age, then group the results into term s, similar to group by in an sql statement.
Buckets in the group under aggregations in the search results are a collection of eligible aggregated results, that is, buckets.
group is the name given to the entire grouping result