elasticsearch-aggregation

How to correctly query inside of terms aggregate values in elasticsearch, using include and regex?

て烟熏妆下的殇ゞ 提交于 2021-01-27 07:01:51
问题 How do you filter out/search in aggregate results efficiently? Imagine you have 1 million documents in elastic search. In those documents, you have a multi_field (keyword, text) tags : { ... tags: ['Race', 'Racing', 'Mountain Bike', 'Horizontal'], ... }, { ... tags: ['Tracey Chapman', 'Silverfish', 'Blue'], ... }, { ... tags: ['Surfing', 'Race', 'Disgrace'], ... }, You can use these values as filters, (facets), against a query to pull only the documents that contain this tag: ... "filter": [

How to correctly query inside of terms aggregate values in elasticsearch, using include and regex?

雨燕双飞 提交于 2021-01-27 06:56:28
问题 How do you filter out/search in aggregate results efficiently? Imagine you have 1 million documents in elastic search. In those documents, you have a multi_field (keyword, text) tags : { ... tags: ['Race', 'Racing', 'Mountain Bike', 'Horizontal'], ... }, { ... tags: ['Tracey Chapman', 'Silverfish', 'Blue'], ... }, { ... tags: ['Surfing', 'Race', 'Disgrace'], ... }, You can use these values as filters, (facets), against a query to pull only the documents that contain this tag: ... "filter": [

ElasticSearch - Filter Buckets

有些话、适合烂在心里 提交于 2021-01-05 07:21:32
问题 My elasticSearch query is like: { "size": 0, "aggs": { "group_by_id": { "terms": { "field": "Infos.InstanceInfo.ID.keyword", "size": 1000 }, "aggs": { "tops": { "top_hits": { "size": 100, "sort": { "Infos.InstanceInfo.StartTime": "asc" } } } } } } } It works fine, I have a result of this form: aggregations =========>group_by_id ==============>buckets {key:id1} ===============>docs {doc1.Status:"KO"} {doc2.Status:"KO"} {key:id2} ===============>docs {doc1.Status:"KO"} {doc2.Status:"OK"} {key

ElasticSearch - How to display an additional field name in aggregation query

孤街醉人 提交于 2020-12-02 02:21:31
问题 How can I add a new key called 'agency_name' in my output bucket. I am running an aggregation code as shown below { "aggs": { "name": { "terms": { "field": "agency_code" } } } } I will be getting the out put as "aggregations": { "name": { "doc_count_error_upper_bound": 130, "sum_other_doc_count": 39921, "buckets": [ { "key": "1000", "doc_count": 105163 }, { "key": "2100", "doc_count": 43006 } ] } } While displaying I need to show the agency name, code and doc_count How can I modify the

ElasticSearch - How to display an additional field name in aggregation query

回眸只為那壹抹淺笑 提交于 2020-12-02 02:17:23
问题 How can I add a new key called 'agency_name' in my output bucket. I am running an aggregation code as shown below { "aggs": { "name": { "terms": { "field": "agency_code" } } } } I will be getting the out put as "aggregations": { "name": { "doc_count_error_upper_bound": 130, "sum_other_doc_count": 39921, "buckets": [ { "key": "1000", "doc_count": 105163 }, { "key": "2100", "doc_count": 43006 } ] } } While displaying I need to show the agency name, code and doc_count How can I modify the