gpt4 book ai didi

java - 如何使用 json 在 solr 更新上一次插入多个索引

转载 作者:行者123 更新时间:2023-12-01 11:36:24 24 4
gpt4 key购买 nike

我引用了不同的相关网页来了解如何在单个请求中将多个索引发布到 solr。我已经浏览了 solr 链接 http://wiki.apache.org/solr/UpdateJSON#Example但链接解释功能不太清楚。

我还发现创建一个像这样的 json:

{
"add": {"doc": {"id" : "TestDoc1", "title" : "test1"} },
"add": {"doc": {"id" : "TestDoc2", "title" : "another test"} }
}

可以解决问题。但在这种情况下,只有最后一个索引被更新/插入到索引中。我的项目是一个java项目。请帮我解决这个问题。

最佳答案

JSON 模块支持使用常规 JSON 数组表示法(从 3.2 开始)。如果您要添加文档,则也不需要“添加”键:

[
{
"id" : "MyTestDocument",
"title" : "This is just a test"
},
{
"id" : "MyTestDocument2",
"title" : "This is antoher test"
}
]

关于java - 如何使用 json 在 solr 更新上一次插入多个索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29946232/

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