If you can aggregate by field in all types:
curl -XGET 'localhost:9200/index/type1,type2,type3,typeN/_search/?pretty=true' -d '{
"query": {
"filtered": {
"query": {
"match_all": {}
}
}
},
"size": 0,
"aggs": {
"field_aggs": {
"terms": {
"size": 0,
"field": "field_common_on_all_types"
},
"aggs": {
"testing": {
"terms": {
"field": "_type"
},
"aggs": {
"testing": {
"date_histogram": {
"field": "date_start",
"interval": "month",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
}
}
}
}
}'
source
share