Elasticsearchpython bulk helper API上没有筛选器路径选项

2024-10-02 10:35:03 发布

您现在位置:Python中文网/ 问答频道 /正文

来自\u index\u bulkAPI的响应包含相当多的信息。此信息对于排除请求故障或实现重试逻辑非常有用,但可能会占用大量带宽。在本例中,索引32字节的文档将导致339字节的响应(包括标题):

如果我们更新/索引如下文档

PUT elasticsearch_domain/more-movies/_doc/1
{"title": "Back to the Future"}

它会返回如下的响应

{
  "_index": "more-movies",
  "_type": "_doc",
  "_id": "1",
  "_version": 4,
  "result": "updated",
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  },
  "_seq_no": 3,
  "_primary_term": 1
}

现在,如果我们使用_bulkAPI在现有索引过程中使用过滤器路径

PUT elasticsearch_domain/more-movies/_doc/1?filter_path=result,_shards.total
{"title": "Back to the Future"}

然后反应会是

{
  "result": "updated",
  "_shards": {
    "total": 2
  }
}

所以我的问题是如何使用filter\u path过滤掉带有Elasticsearch-python bulk API或流式批量API的响应?


Tags: 文档信息indexdoc字节puttitledomain

热门问题