gpt4 book ai didi

lucene - 为什么路由不适用于 ElasticSearch Bulk API?

转载 作者:行者123 更新时间:2023-11-29 02:53:50 25 4
gpt4 key购买 nike

我正在向 ElasticSearch 设置批量请求并指定要路由到的分片。

但是当我运行它时,文档会被发送到不同的分片。

这是 ElasticSEarch 批量中的错误吗?当我只索引一个文档时它会起作用。它在我搜索时起作用。但当我进行批量导入时不会。

重现:

curl -XPOST 'http://192.168.1.115:9200/_bulk?routing=a' -d '
{ "index" : { "_index" : "articles", "_type" : "article", "_id" : "1" } }
{ "title" : "value1" }
{ "delete" : { "_index" : "articles", "_type" : "article", "_id" : "2" } }
{ "create" : { "_index" : "articles", "_type" : "article", "_id" : "3" } }
{ "title" : "value3" }
{ "update" : {"_id" : "1", "_type" : "article", "_index" : "index1"} }
{ "doc" : {"field2" : "value2"} }'

最佳答案

所以在 URL 末尾添加“路由”参数是行不通的。

我需要将“_routing”字段添加到实际文档字段以指定它将转到哪个分片。

非常不直观,我希望 ElasticSearch 能记录下来!有时我希望我只选择 Solr :*(

希望这对以后寻找这个的人有帮助

curl -XPOST 'http://192.168.1.115:9200/_bulk?routing=a' -d '
{ "index" : { "_index" : "articles", "_type" : "article", "_id" : "1", "_routing" : "b"} }
{ "title" : "value1" }
{ "delete" : { "_index" : "articles", "_type" : "article", "_id" : "2", "_routing" : "b" } }
{ "create" : { "_index" : "articles", "_type" : "article", "_id" : "3", "_routing" : "b" } }
{ "title" : "value3" }
{ "update" : {"_id" : "1", "_type" : "article", "_index" : "index1", "_routing" : "b"} }
{ "doc" : {"field2" : "value2"} }'

关于lucene - 为什么路由不适用于 ElasticSearch Bulk API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19745515/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com