加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – MapperParsingException:没有在字段上声明的类型[dat

发布时间:2020-12-20 12:22:49 所属栏目:Python 来源:网络整理
导读:我正在为Elasticsearch开发一个带 Python Pyes客户端的驱动程序.我需要带有日期列的映射索引,格式为“date_hour_minute_second”,基于docs http://www.elasticsearch.org/guide/reference/mapping/date-format/,我也检查了pyes docs https://pyes.readthedoc
我正在为Elasticsearch开发一个带 Python Pyes客户端的驱动程序.我需要带有日期列的映射索引,格式为“date_hour_minute_second”,基于docs http://www.elasticsearch.org/guide/reference/mapping/date-format/,我也检查了pyes docs https://pyes.readthedocs.org/en/latest/guide/reference/mapping/date-format.html

当我在我的字段中使用“date_hour_minute_second”格式时,我得到了标题中提到的异常.

这是我的字段定义:

"date": {
           "boost": 1.0,"store": "yes","type": "date_hour_minute_second_fraction","term_vector": "with_positions_offsets"
       }

我无法弄明白为什么它会抛出一个例外,即使是文档说它是受支持的.

解决方法

我认为你把映射略有错误,你所拥有的“日期”是字段名称,你还需要“类型”:“日期”试试这个:

"date": {
    "type": "date","format": "date_hour_minute_second_fraction","store": "yes"
}

“boost”默认为1.0,所以不需要.

另外我会质疑为什么你需要“存储”:“是”,除非你已经关闭了全局存储(它默认打开,并且可以检索你发送给elasticsearch的整个文档).

最后,“term_vector”:“with_positions_offsets”不是“日期”类型的适用参数.看看at the elasticsearch docs on core types and scroll to the date section.

祝好运!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读