[英]SOLR - Update one field in a document using postman json query
我正在試驗 SOLR,需要在 postman 中使用 json 更新文檔中的一個字段,我查看了文檔和帖子,但我無法讓它工作,這對於這樣一個常見的操作來說似乎很奇怪。
我有以下文件:
{
"id":"556c630c-125c-4b52-8fa5-c26daf187782",
"started":false,
"cancelled":false,
"complete":false
}
我在 postman 中嘗試了以下操作:
--url:8983/solr/task-core/update/json/docs?commit=true
--json:
{
"id":"556c630c-125c-4b52-8fa5-c26daf187782",
"started":true,
}
但這會覆蓋整個文檔。
我在某處讀到您可以使用“set”,但我無法使用任何組合,如果有幫助,我正在使用 SOLR 7.7.1。
選擇它部分更新文件如下
{
"id": "123",
"author" : "Solr Updates"
}
讓我們在文檔中添加一個作者字段,字段值將是一個 json object 帶有"set"
屬性和字段值
$ curl http://localhost:8983/solr/update -H 'Content-type:application/json' -d '
[
{"id" : "123",
"author" : {"set":"Robert Wark"}
}
]'
查詢后,您的新文檔將如下所示
$ curl http://localhost:8983/solr/get?id=123
更新文件是:
{
"doc" : {
"id" : "123",
"author": "Robert Wark"
}
}
請參考文檔:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.