To give some additional information, the mapping for the documents is currently:
{
"_all" : { "enabled": false },
"properties" : {
"field1" : {
"type" : "text",
"fielddata": true,
"fields" : {
"keyword" : {
"type" : "keyword",
"eager_global_ordinals": true
}
}
},
"field2" : {
"type" : "text",
"fielddata": true,
"fields" : {
"keyword" : {
"type" : "keyword",
"eager_global_ordinals": true
}
}
},
"field3" : {
"type" : "text",
"fielddata": true,
"fields" : {
"keyword" : {
"type" : "keyword",
"eager_global_ordinals": true
}
}
},
"field4" : {
"type" : "text",
"fielddata": true,
"fields" : {
"keyword" : {
"type" : "keyword",
"eager_global_ordinals": true
}
}
},
"field5" : {
"type" : "text",
"fielddata": true,
"fields" : {
"keyword" : {
"type" : "keyword",
"eager_global_ordinals": true
}
}
},
"field6" : {
"type" : "date",
"format" : "basic_date_time_no_millis"
},
"field7" : {
"type" : "date",
"format" : "basic_date_time_no_millis"
},
"field8" : {
"type" : "date",
"format" : "basic_date_time_no_millis"
},
"field9" : {
"type": "text"
},
"field10" : {
"type": "text"
},
"field11" : {
"type" : "text",
"fielddata": true,
"fields" : {
"keyword" : {
"type" : "keyword",
"eager_global_ordinals": true
}
}
},
"field12" : {
"type" : "long"
}
}
}
And an example aggregation would be:
{
"size" : 0,
"query" : {
"match_all" : { }
},
"_source" : false,
"aggregations" : {
"by_terms" : {
"terms" : {
"field" : "field11.keyword",
"size" : 10000,
"shard_size" : 1000000,
"min_doc_count" : 1,
"shard_min_doc_count" : 0,
"show_term_doc_count_error" : false,
"order" : [
{
"_count" : "desc"
},
{
"_term" : "asc"
}
]
},
"aggregations" : {
"totalSize" : {
"sum" : {
"field" : "size"
}
}
}
}
}
}