0
PUT _ingest/pipeline/trim
{
  "description" : "trims my name field",
  "processors" : [ {
      "trim" : {
        "field": "country"
      }
  } ]
}

POST suppliers/_update_by_query?pipeline=trim

我想要上述 Kibana 语法的 Python 语法

4

2 回答 2

0

我使用邮递员和 curl.trillworks.com

import requests

headers = {
    'Content-Type': 'application/json',
}

data = '{\n  "description" : "trims my name field",\n  "processors" : [ {\n      "trim" : {\n        "field": "country"\n      }\n  } ]\n}'

response = requests.put('http://localhost:9200/_ingest/pipeline/trim', headers=headers, data=data)

但也许你应该检查 python ES 客户端

于 2019-08-26T20:32:58.583 回答
0

对于 Python,您需要导入某些库

from elasticsearch.client.ingest import IngestClient
from elasticsearch import Elasticsearch
es=Elasticsearch()
p = IngestClient(es)


body = {
        "description" : "trims my name field",
        "processors": [
            {
                "trim": {
                    "field": "country"
                    }
                }
            ]
        }
p.put_pipeline(id="trim",body=body)
es.update_by_query(index="suppliers",pipeline="trim")

于 2019-08-29T07:41:15.153 回答