Curl witch Aggs and Time

I have a curl that can search the top sender:

curl -XGET "http://localhost:9200/_search" -H 'Content-Type: application/json' -d'
{
"size": 0,
"aggs": {
	"group_by_state": {
		"terms": {
			"field": "remetente.keyword"
		}
	}
}
}'

and another quem search for a range of date:

curl -XGET "http://localhost:9200/_search" -H 'Content-Type: application/json' -d'
{
"aggs":{
	"range": {
		"date_range": {
			"field": "data1",
			"format": "MM-yyy",
			"ranges": [
				{ "to": "now-10M/M" },
				{ "from": "now-10M/M" } 
			]
		}
	}
}
}'

i want to make this two curl with one unique curl, someone can help-me?

Hi,

What about this?

curl -XGET "http://localhost:9200/_search" -H 'Content-Type: application/json' -d'
{
"size": 0,
"aggs": {
	"group_by_state": {
		"terms": {
			"field": "remetente.keyword"
		}
	},
        "range": {
		"date_range": {
			"field": "data1",
			"format": "MM-yyy",
			"ranges": [
				{ "to": "now-10M/M" },
				{ "from": "now-10M/M" } 
			]
		}
	}
}
}'

Thx, now is working fine.

but, the range of date still wrong, for the last 15m of logs, how would it be the data format?
the format of field data1 is : 'June 18th 2019, 12:39:41.000'.

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