Skip to main content
Version: 1.3.0

elasticquerystats

The command elasticquerystats queries aggregated data in Elasticsearch with a DSL query saved in ElasticSPL. Queries run by elasticquerystats return aggregated data as results. Therefore, the data is formatted as a table. Timestamp fields and dynamic timestamp parsing are available with the command even though the returned data does not need to be time-series data.

Arguments

argumentrequiredformatdescription
instanceyesstringelastic instance used by the query
search_nameyesstringname of the saved query
timestamp_fieldnostringfield in Elasticsearch data containing the events timestamp
timestamp_usednobooleandefines if the time given in the Splunk Search is used for the query
replacementsnostringkv-pairs used to replace tokens in query
modenostring"stats" or "esql", defaults to "stats"

A saved DSL query defines default values for timestamp_field, timestamp_used, timestamp_format, and replacements`. As long as the user does not provide the argument, the value stored with the query is used. In case of replacements, the KV-pairs are merged. The user-provided input takes precedence if there is a definition for a key in the user's input and the saved arguments.

Examples

Get a distribution over the sales of products by time and product category

Kibana Graph

Permissions

All users with the role elastic_user can run the elasticquerystats command. The command itself does not grant any access to the data. The access to the data is controlled by the saved query. The saved query has an access control list that defines which users are allowed to run the query. The access control list is managed in the configuration dashboard of ElasticSPL.