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

没有在字段[title]上声明的[text]类型的处理程序(python elastic

发布时间:2020-12-16 22:41:51 所属栏目:Python 来源:网络整理
导读:所有. 我使用的python elasticsearch版本是 import elasticsearchprint elasticsearch.__version__(5,1) 映射是 request_body = { 'mappings':{ 'post': { 'properties': { 'title': { 'type': 'text',} } } }} 错误是: {ustatus: 400,uerror: {ucaused_by:

所有.
我使用的python elasticsearch版本是

import elasticsearch
print elasticsearch.__version__
(5,1)

映射是

request_body = {
    'mappings':{
        'post': {
            'properties': {
                'title': {
                    'type': 'text',}
            }
        }
    }
}

错误是:

{u’status’: 400,u’error’: {u’caused_by’: {u’reason’: u’No handler for
type [text] declared on field [title]’,u’type’:
u’mapper_parsing_exception’},u’root_cause’: [{u’reason’: u’No handler
for type [text] declared on field [title]’,u’type’:
u’mapper_parsing_exception’}],u’type’: u’mapper_parsing_exception’,
u’reason’: u’Failed to parse mapping [post]: No handler for type
[text] declared on field [title]’}}

为什么es 5.0无法识别“文本”类型?我的设置有什么问题?
非常感谢!

最佳答案
您的映射中存在一些问题.用双引号替换所有单引号,并在最后一行(字段类型定义)后删除.

    {  
      "mappings":{  
        "post":{  
          "properties":{  
            "title":{  
              "type":"text"
            }
          }
        }
      }
    }

(编辑:李大同)

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

    推荐文章
      热点阅读