elasticsearch映射没有JSON对象

2024-10-03 09:08:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用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映射指南,我使用textkeyword而不是{}当使用string时,字段没有被正确地提取和索引。在

^{3}$

Tags: 文件数据text脚本jsontrue参数date