/_search

This API exposes the elasticsearch search API. The API restricts all searches to the dataset belonging to the current customer.
With this API, you can fetch the raw statistics data and build your own aggregations.

Aggregations:

Use any of the aggregation types to aggregate your data.

For instance if you want to know how many users got a notification, you need to define a value_count aggregation on your dataset:

{
    "size": 0,    
    "aggs": {
        "user_count": {
            "value_count": {
                "field": "device.uid"
            }
        }
    }
}

We set the size to zero since we are only interested in the aggregation results. Another sample aggregation will return the device unique identifiers:

{
    "size": 0,    
    "aggs": {
        "users": {
            "terms": {
                "field": "device.uid",
                "size" : 100
            }
        }
    }
}

You can nest aggregations as well. In this example, we split by operating system and then by operating system version:

{
    "size": 0,    
    "aggs": {
        "users": {
            "terms": {
                "field": "device.os",
                "size" : 5
            },
            "aggs" :{
                "device_types" : {
                    "terms" : {
                        "field" : "device.osVersion"
                    }
                }
            }            
        }
    }
}

Queries

In this example POST body, we are interested in data from the last 100 days. You can use the must part of the query and add your own queries. Study the range query documentation for more details.

{
    "size": 100,
  	"from" : 0,
    "query": {
        "bool": {
            "must": [
                {
                    "range": {
                        "trigger.timestamp": {
                            "gte": "now-100d"
                        }
                    }
                }
            ]
        }
    }    
}

Other useful query types:

Queries are also applied to the aggregations, so you can combine these two examples and get the user count for the last X days.

🚧

Should query part cannot be used

Please note, the should part of the bool query cannot be changed. Any should query parts will be overridden.

Pagination

Use the elasticsearch pagination API to get paginated results.

Fields

If you are only interested in parts of the document, use the fields API of elasticsearch.

Language
Credentials
Header
Click Try It! to start a request and see the response here!