У меня есть документы, содержащие URL. Следующий запрос агрегирует документы по URL
GET logs/_search
{
"size": 0,
"aggregations": {
"refererTerms": {
"terms": {
"field": "sit_ref.keyword",
"size": 5
}
}
}
}
Выход:
{
"took": 560,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 4809178,
"max_score": 0,
"hits": []
},
"aggregations": {
"refererTerms": {
"doc_count_error_upper_bound": 12590,
"sum_other_doc_count": 2440897,
"buckets": [
{
"key": "https://www.bfmtv.com/",
"doc_count": 217615
},
{
"key": "https://www.zone-turf.fr/quinte/",
"doc_count": 46506
},
{
"key": "https://www.01net.com/telecharger/",
"doc_count": 43178
},
{
"key": "https://rmcsport.bfmtv.com/",
"doc_count": 42643
},
{
"key": "https://bfmbusiness.bfmtv.com/",
"doc_count": 38462
}
]
}
}
}
Я хочу объединить документы по их домену, а не по URL. Как я могу пересмотреть поле "sit_ref" для агрегирования по домену?