RequestError:TransportError(400,'parse_exception','不存在名称为[attachment]的处理器类型')

时间:2017-03-28 04:27:34

标签: python elasticsearch lucene

我正在尝试创建一个管道来在python客户端中使用Ingest Attachment Processor插件,如下所示:

 from elasticsearch import Elasticsearch
 es = Elasticsearch()
 body = {
          "description" : "Extract attachment information",
           "processors" : [
            {
                 "attachment" : {
                 "field" : "data"
                    }
             }
           ]
         }
      es.index(index='_ingest', doc_type='pipeline', id='attachment', body=body)

执行此操作时,我收到以下错误:

---------------------------------------------------------------------------
RequestError                              Traceback (most recent call last)
<ipython-input-32-dcd3f26dc39d> in <module>()
 ----> 1 es.index(index='_ingest', doc_type='pipeline', id='attachment',    body=body)

   C:\Users\ananda\AppData\Local\Continuum\Anaconda3\lib\site-    packages\elasticsearch\client\utils.py in _wrapped(*args, **kwargs)
    71                 if p in kwargs:
    72                     params[p] = kwargs.pop(p)
    ---> 73             return func(*args, params=params, **kwargs)
    74         return _wrapped
    75     return _wrapper

    C:\Users\ananda\AppData\Local\Continuum\Anaconda3\lib\site-   packages\elasticsearch\client\__init__.py in index(self, index, doc_type, body, id, params)
    298                 raise ValueError("Empty value passed for a required argument.")
    299         return self.transport.perform_request('POST' if id in SKIP_IN_PATH else 'PUT',
    --> 300             _make_path(index, doc_type, id), params=params, body=body)
   301 
   302     @query_params('parent', 'preference', 'realtime', 'refresh', 'routing')

   C:\Users\ananda\AppData\Local\Continuum\Anaconda3\lib\site-packages\elasticsearch\transport.py in perform_request(self, method, url, params, body)
  316 
  317             try:
  --> 318                 status, headers, data =   connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
  319 
  320             except TransportError as e:

  C:\Users\ananda\AppData\Local\Continuum\Anaconda3\lib\site-packages\elasticsearch\connection\http_urllib3.py in perform_request(self, method, url, params, body, timeout, ignore)
  126         if not (200 <= response.status < 300) and response.status not in ignore:
  127             self.log_request_fail(method, full_url, url, body, duration, response.status, raw_data)
  --> 128             self._raise_error(response.status, raw_data)
  129 
  130         self.log_request_success(method, full_url, url, body, response.status,

  C:\Users\ananda\AppData\Local\Continuum\Anaconda3\lib\site-packages\elasticsearch\connection\base.py in _raise_error(self, status_code, raw_data)
  120             logger.warning('Undecodable raw error response from server: %s', err)
  121 
   --> 122         raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
  123 
  124 

  RequestError: TransportError(400, 'parse_exception', 'No processor type exists with name [attachment]')

我的ES正在运行:

es.cat.health()
'1490674396 09:43:16 elasticsearch green 1 1 0 0 0 0 0 0 - 100.0%\n'

我无法在ES日志中看到任何奇怪的内容:

[2017-03-28T09:49:01,960][INFO ][o.e.n.Node               ] version[5.2.0],   pid[12692], build[24e05b9/2017-01-24T19:52:35.800Z], OS[Windows 10/10.0/amd64],   JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_111/25.111-b14]
[2017-03-28T09:49:03,132][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [aggs-matrix-stats]
[2017-03-28T09:49:03,132][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [ingest-common]
[2017-03-28T09:49:03,132][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [lang-expression]
[2017-03-28T09:49:03,132][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [lang-groovy]
[2017-03-28T09:49:03,132][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [lang-mustache]
[2017-03-28T09:49:03,132][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [lang-painless]
[2017-03-28T09:49:03,132][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [percolator]
[2017-03-28T09:49:03,132][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [reindex]
[2017-03-28T09:49:03,132][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [transport-netty3]
[2017-03-28T09:49:03,147][INFO ][o.e.p.PluginsService     ] [R8e0KZa] loaded module [transport-netty4]
[2017-03-28T09:49:03,147][INFO ][o.e.p.PluginsService     ] [R8e0KZa] no plugins loaded
[2017-03-28T09:49:06,768][INFO ][o.e.n.Node               ] initialized  
[2017-03-28T09:49:06,768][INFO ][o.e.n.Node               ] [R8e0KZa] starting ...
[2017-03-28T09:49:08,294][INFO ][o.e.t.TransportService   ] [R8e0KZa] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
[2017-03-28T09:49:11,391][INFO ][o.e.c.s.ClusterService   ] [R8e0KZa] new_master {R8e0KZa}{R8e0KZacS_WD0BsOnVTK8Q}{AiE29E1xRBasGeaqmONqvQ}{127.0.0.1}          {127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-03-28T09:49:11,459][INFO ][o.e.g.GatewayService     ] [R8e0KZa] recovered [0] indices into cluster_state
[2017-03-28T09:49:12,745][INFO ][o.e.h.HttpServer         ] [R8e0KZa] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2017-03-28T09:49:12,745][INFO ][o.e.n.Node               ] [R8e0KZa] started

请指点我这里出了什么问题......

1 个答案:

答案 0 :(得分:1)

你得到的错误是在最后一行

No processor type exists with name [attachment]

首先需要install the attachment plugin才能使用

sudo bin/elasticsearch-plugin install ingest-attachment

然后你可以重新启动ES,它会起作用。