Elasticsearch filter aggregations on minimal doc count

前端 未结 1 1579
囚心锁ツ
囚心锁ツ 2020-12-17 20:50

I am really new to elasticsearch world.

Let\'s say I have a nested aggregation on two fields : field1 and field2 :

{
    .         


        
相关标签:
1条回答
  • 2020-12-17 21:07

    Next time, M'sieur Toph' : RTFM !!!

    I feel really dumb: I found the anwser in the manual, 30 seconds after asking. I don't remove my question because, it can help, who knows...

    Here is the anwser :

    You can specify the min_doc_count property in the terms aggregation.

    It gives you :

    {
        ...
        aggs: {
            field1: {
                terms: {
                    field: 'field1',
                    min_doc_count: 1000
                },
                aggs: {
                    field2: {
                        terms: {
                            field: 'field2',
                            min_doc_count: 1000
                        }
                    }
                }
            }
        }
    }
    

    You also can specify a specific minimal count for each level of your aggregation.

    What else ? :)

    0 讨论(0)
提交回复
热议问题