Hi,
I have a query that searches for a specific field value within the last hour. the problem is that this query will find roughly 4 documents each time as that is how often the data is generated. I'm trying to limit the results to 1 result per device. My query and the resulting error are both below. Any advice/help would be greatly appreciated
POST /_search
{
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-1h"
}
}
},
{
"match": {
"osquery.result.columns.mdm": "active"
}
},
{
"aggregations": {
"hosts": {
"terms": {
"field": "osquery.result.decorations.hostname",
"size": 1
}
}
}
}
]
}
}
}
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "no [query] registered for [aggregations]",
"line": 18,
"col": 27
}
],
"type": "parsing_exception",
"reason": "no [query] registered for [aggregations]",
"line": 18,
"col": 27
},
"status": 400
}