我尝试使用python脚本csv2es将数据加载到elasticsearch 5。在
传递给csv2es的参数引用带有elasticsearch映射的json文件。加载以下映射文件时:
{
"dynamic": "true",
"properties": {
"username": {"type": “text”},
"date": {"type": "date", "format" : "yyyy-MM-dd HH:mm"},
"retweets": {"type": “integer”},
"favourites": {"type": “integer”},
"text": {"type": “text”},
"geo": {"type": “keyword”},
"mentions": {"type": “text”},
"hashtags": {"type": “text”},
"id": {"type": “keyword”},
"permalink": {"type": “keyword”}
}
}
这将引发以下错误:
^{pr2}$但是,当我加载以下文件时,数据加载将运行。根据ES5映射指南,我使用text
和keyword
而不是{string
时,字段没有被正确地提取和索引。在
afaik,这个错误意味着你的json数据无效。 在}quotation mark。在
“text”
中,它被“
left double quotation mark包围,而不是{升级python,这样在解码json字符串或使用
simplejson
库时可以看到可读错误。在看这个:Displaying better error message than "No JSON object could be decoded"
相关问题 更多 >
编程相关推荐