SOLR可以执行UPSERT吗? [英] Can SOLR perform an UPSERT?
问题描述
我一直在尝试在solr中做一个UPSERT(如果已经存在,请插入或更新).我只知道什么不起作用,并且我阅读的Solr/Lucene文档没有帮助.这是我尝试过的:
I've been attempting to do the equivalent of an UPSERT (insert or update if already exists) in solr. I only know what does not work and the solr/lucene documentation I have read has not been helpful. Here's what I have tried:
curl 'localhost:8983/solr/update?commit=true' -H 'Content-type:application/json' -d '[{"id":"1","name":{"set":"steve"}}]'
{"responseHeader":{"status":409,"QTime":2},"error":{"msg":"Document not found for update. id=1","code":409}}
我在一个请求中最多进行50个更新,并且请求中可能包含相同ID的专有字段(例如title_en和title_es).如果有一种查询ID列表是否存在的方法,我可以拆分数据并执行单独的插入和更新命令...这是可以接受的替代方法,但是已经有一个处理程序吗?在这一点上,我想避免做任何内部例程.
I do up to 50 updates in one request and request may contain the same id with exclusive fields (title_en and title_es for example). If there was a way of querying whether or not a list of id's exist, I could split the data and perform separate insert and update commands... This would be an acceptable alternative but is there already a handler that does this? I would like to avoid doing any in house routines at this point.
谢谢.
推荐答案
With Solr 4.0 you can do a Partial update of all those document with just the fields that have changed will keeping the complete document same. The id should match.
这篇关于SOLR可以执行UPSERT吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!