【问题标题】:No handler for type [text] declared on field [title] (python elasticsearch没有在字段 [title] 上声明的类型 [text] 的处理程序(python elasticsearch
【发布时间】:2018-11-04 01:20:43
【问题描述】:

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

import elasticsearch
print elasticsearch.__version__
(5, 0, 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] 在字段 [title]' 上声明,u'type': u'mapper_parsing_exception'}, u'root_cause': [{u'reason': u'没有处理程序 对于在字段 [title]' 上声明的类型 [text],u'type': u'mapper_parsing_exception'}],u'type':u'mapper_parsing_exception', u'reason': u'Failed to parse mapping [post]: No handler for type 在字段 [title]'}}

上声明的 [text]

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

【问题讨论】:

    标签: python elasticsearch


    【解决方案1】:

    您的映射存在几个问题。将所有单引号替换为双引号,并去掉最后一行后面的,(字段类型定义。)

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

    【讨论】:

    • 谢谢!错误依然存在! elasticsearch.exceptions.RequestError: TransportError(400, u'mapper_parsing_exception', u'No handler for type [text] declared on field [title]')
    • text 类型在 elasticsearch 5.x 中只有 introduced,你确定你在 elasticsearch 5.x 上吗?
    • 感谢您的帮助!我只安装python版本。 import elasticsearch print elasticsearch.__version__ (5, 0, 1) 我应该安装java版本吗?
    • 我看的是es版本,是es 2.2.1? {u'cluster_name': u'elasticsearch', u'tagline': u'You Know, for Search', u'version': {u'lucene_version': u'5.4.1', u'build_hash': u' d045fc29d1932bce18b2e65ab8b297fbf6cd41a1', u'number': u'2.2.1', u'build_timestamp': u'2016-03-09T09:38:54Z', u'build_snapshot': False}, u'name': u'Lorelei Travis '} 我怎样才能得到 es 5.X 谢谢!
    • @RaviNaik 在 elasticsearch 2.x 中“文本”类型是否有任何替代方法?我遇到了同样的错误,必须使用 elasticsearch 2.x
    【解决方案2】:

    【讨论】:

      【解决方案3】:

      升级到最新的 Elastic Search,我有一些旧版本 2,现在有支持 [text] 的版本 6

      【讨论】:

        猜你喜欢
        • 2016-10-02
        • 1970-01-01
        • 2017-08-04
        • 1970-01-01
        • 1970-01-01
        • 2018-06-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多