如何聚集在其上具有一格式11/03/2015
即治疗字符串作为日期,而无需重新索引类型的字符串字段?例如,考虑的映射关系对一个Elasticsearch index:sport
,type:athlete
:如何聚集在字符串类型的elasticsearch字段,其包括一斜杠(/)
curl -XPUT "http://localhost:9200/sports/" -d'
{
"mappings": {
"athlete": {
"properties": {
"birthdate": {
"type": "string"
},
"name": {
"type": "string"
},
"score": {
"type": "integer"
},
"sport": {
"type": "string"
}
}
}
}
}
集结上birthdate
出现使用/
分离字段,因此聚集体上11/03/2015
作为11
,03
,2015
而不是采取作为一个整体和聚集在它。如何解决这个问题? :
"buckets": [
{
"key": "2015",
"doc_count": 24
},
{
"key": "11",
"doc_count": 21
},
{
"key": "03",
"doc_count": 3
}
]