Answer the question
In order to leave comments, you need to log in
Elasticsearch grouping and limit?
The index consists of entity_id, type, name fields.
The search is carried out by the name field, but in the search result you need to display 10 results for each type (there are 3 types in total so far).
How can this be configured?
Answer the question
In order to leave comments, you need to log in
It? https://www.elastic.co/guide/en/elasticsearch/refe...
{
"size": 10,
"query": {....}
}
Well, something like this.
Top hits aggregation
Terms aggregation
curl -XGET http://localhost:9200/index/type/_search -d '{
"query": {
"match_all": {}
},
"aggs": {
"group_by_types": {
"terms": {
"field": "type"
},
"aggs": {
"top_hits_in_group": {
"top_hits": {
"size": 10
}
}
}
}
}
}'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question