May 12 2015

Sorting a percentiles aggregation in Elasticsearch

I tried a lot of different things until I arrived at this point...

{
    "aggs": {
        "group_by_normalized_url": {
            "terms": {
                "field": "normalized_url",
                "order": {
                    "90th_percentile[90.0]": "desc"
                }
            },
            "aggs": {
                "90th_percentile": {
                    "percentiles": {
                        "field": "wt",
                        "percents": [
                            90
                        ]
                    }
                }
            }
        }
    }
}
May 04 2015

docker inspect inside an Ansible task with a Go template

This has bugged me on and off for a little while and I've finally found a way that works. Here's an example:

- command: >
    docker inspect -f \{\{' 'index' '.NetworkSettings.Ports' '\"8080/tcp\"' '0' '\"HostPort\"\}\} jenkins
  register: port

Info

I'm Ade Slade, a PHP web developer.