How to filter the aggregated data

I use bucket_script in my search, and I got a new field called "useagerss" by bucket_script. Now, i holp to filter the data.When the "useagerss" is greater than 0.85,print it to the result,conversely, not print to the result. but I don't know how to implement it.

my configuration:

                    "useagerss": {
                      "bucket_script": {
                        "buckets_path": {
                          "available": "3",
                          "usage": "4",
                          "rss": "5"
                        },
                        "script": {
                          "source": "params.rss / ( params.available + params.usage) > 0.85 ? (params.rss / ( params.available + params.usage)):0",
                          "lang": "painless"
                        },
                        "format": "#.##"
                      }
                    }

The above method just lets it print to 0 when the value is less than 0.85, but it does not discard it.

How should I solve it? Can you give me an example?

The bucket selector aggregation allows you to do exactly that.

Thank you very much! abdon.This problem has been solved.

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