我将来自Apache Spark的文档通过Structured Streaming插入到ES中。
但是Spark-ES连接器中存在一个未解决的错误(https://github.com/elastic/elasticsearch-hadoop/issues/1173),其负面影响是源端(Spark)上的日期字段作为unix发送-timestamps / long类型到接收器(ES)。
我认为在ES端转换它的索引模板可能是一个很好的解决方法,可以在ES中使用正确的格式(日期)。
我的索引模板是:
{
"index_patterns": "my_index_*",
"mappings": {
"peerType_count": {
"dynamic_templates": [
{
"timestamps": {
"path_match": "*.window.*",
"match_mapping_type": "long",
"mapping": {
"type": "date",
"format": "epoch_millis"
}
}
}
]
}
}
}
但是ES中的文档仍然是unix时间戳: - /
{
"_index": "my_index",
"_type": "peerType_count",
"_id": "kUGWNmcBtkL7EG0gS280",
"_version": 1,
"_score": 1,
"_source": {
"window": {
"start": 1535958000000,
"end": 1535958300000
},
"input__source_peerType": "peer2",
"count": 1
}
}
有人知道可能是什么问题吗?
PS:有没有可用的es-mapping-debugger?