Setting tdigest compression for percentile aggregations in visualisations [Kibana 6.5]

Hi there,
I'm running Kibana 6.5 and I have a data table visualisation where I'm showing the 95th percentile of a field, however the value is too inconsistent due to the approximation calculation for percentiles. I've seen that you can set the compression value for the tdigest approximation algorithm in an Elasticsearch query to improve the accuracy at the cost of more memory usage.

I'm looking to see the following included in the visualisation's query to Elasticsearch:

{
    "aggs": {
        ...
        "3": {
            "percentiles": {
                "field": "x",
                "tdigest": {
                    "compression": 1000
                },
                "percents": [
                    95
                ],
                "keyed": false
            }
        }
    }
    ...
}

On a guess, I tried adding the tdigest setting to the visState JSON for the visualisation in a way that seemed like it would correlate to the desired Elasticsearch query:

{
    ...
    "aggs": [
        ...
        {
            "id": "3",
            "enabled": true,
            "type": "percentiles",
            "schema": "metric",
            "params": {
                "field": "x",
                "tdigest": {
                    "compression": 1000
                },
                "percents": [
                    95
                ],
                "customLabel": "X Value"
            }
        }
    ]
}

However, when I inspected the query it sent to Elastic, the tdigest parameters weren't included.

{
    "aggs": {
        ...
        "3": {
            "percentiles": {
                "field": "x",
                "percents": [
                    95
                ],
                "keyed": false
            }
        }
    }
    ...
}

How can I set the tdigest compression value for a visualisation? Is this even possible to do?

Thanks

You should be able to put that in the "JSON Input" text area (hidden in the collapsed "Advanced" section):

Hi @imacpherson

Unfortunately we are no longer maintaining the 6.5 version of Kibana, the last maintained is 6.8.x
I've checked on 6.8 and using the following in the Advanced JSON configuration it worked correctly:

{
    "tdigest": {
        "compression": 1000
    }
}

That's done the trick! Thank you :smiley:

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