Need help to simple sort aggregation by other field

Hi,
my documents in the index have fields named "filter_color" and "filter_color_value".
"filter_color" is an interger mapped field containing a number from 10 to 160.
"filter_color_value" is a string field which contains a translated color value e.g. "red".

In my search query I use several aggregations, on "filter_color" too.
But they are all naturally sorted by _count.

I need to sort that aggregation buckets by the field "filter_color". Tried a lot of things, but nothing worked.

I also tried it with sub-aggregations to get the wanted sort order. What do I have to do?

my aggregation snippet:

    "aggs" : {
        "filter_color_value" : {
            "terms" : {
                "field" : "filter_color_value"
            }
        }
    }

result:

        "filter_color_value" : {
          "doc_count_error_upper_bound" : 0,
          "sum_other_doc_count" : 1,
          "buckets" : [
            {
              "key" : "weiß",
              "doc_count" : 13
            },
            {
              "key" : "schwarz",
              "doc_count" : 11
            },
            {
              "key" : "blau",
              "doc_count" : 8
            },
            {
              "key" : "transparent",
              "doc_count" : 8
            },
            {
              "key" : "orange",
              "doc_count" : 5
            },
            {
              "key" : "rot",
              "doc_count" : 5
            },
            {
              "key" : "grün",
              "doc_count" : 4
            },
            {
              "key" : "gelb",
              "doc_count" : 3
            },
            {
              "key" : "grau",
              "doc_count" : 3
            },
            {
              "key" : "silber",
              "doc_count" : 2
            }
          ]
        }

Thanks for any help!

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