Filtering buckets from aggs


(Daulet) #1

Hi, I am trying to exclude all buckets that are contained in another buckets 'term' field. For example

              {
                "key": "1",
                "doc_count": 2
              },
              {
                "key": "12",
                "doc_count": 2
              },
              {
                "key": "123",
                "doc_count": 2
              },
              {
                "key": "1234",
                "doc_count": 2
              },
              {
                "key": "12345",
                "doc_count": 1
              },
}``

I want the output to be 

``` "buckets":[ {
            "key" : "12345"
            "doc_count" : 1
}]
``
as it contains all other buckets. How can I do this using aggs or filters?

(Christian Dahlqvist) #4

Please be patient. The forum is manned by volunteers and it is now weekend. Also please do not address specific individuals unless they have already responded to your query.


(Christian Dahlqvist) #5

Please be patient. The forum is manned by volunteers and it is now weekend. Also please do not address specific individuals unless they have already responded to your query.


(Daulet) #6

okay, sorry, I am new to this service;D


(Daulet) #7

can u help me?:smiley:


(Christian Dahlqvist) #8

No, unfortunately not. I am on my mobile and the poor connection caused me to post twice.


(Christian Dahlqvist) #9

These all seem to be unrelated terms. How do you determine that one bucket is contained in another? What exactly is it you are trying to achieve?


(Daulet) #10

I am trying to filter these buckets into one, so that the bucket which is contained by another not showed in final result, is it possible?


(Christian Dahlqvist) #11

I still do not understand what you are trying to achieve, so will probably not be able to help.


(Mark Walkom) #12

I don't think that is possible as ES treats them all as separate buckets.


(Daulet) #13

Hi, thank you for your reply.. How do you think, can ES filter from query if we consider that the inputs are not buckets, but just documents? So that, from the filter query we receive the document that is not contained by other document? @warkolm


(system) #14

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.