Hello,
I would like to get unique documents basing on a field (unique_id_field) and by using search_after algorithm
GET /my_index/_search
{
"query": {
"match_all": {}
}
"size": 10000,
"search_after": [sort_field_value],
"sort": [
{
"sort_field": {
"order": "asc"
}
}
]
}
I tried to add an aggregation, but it doesn't work with search_after. I need to set the size to zero in order to get a result. But, by setting the size to zero I can no more use sear_after
GET /my_index/_search
{
"query": {
"match_all": {}
},
"aggs":{
"unique_ids": {
"terms": {
"field": "unique_id_field",
"size": 10000
},
"aggs":{
"dedup_docs":{
"top_hits":{
"size":1
}
}
}
}
},
"size": 0,
"sort": [
{
"sort_field": {
"order": "asc"
}
}
]
}