You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Issei Nishigata <du...@gmail.com> on 2018/05/10 13:51:21 UTC

How to replacing values on multiValued all together by using 1 query

Hi, all


I create a field called employee_name, and use it as multiValued.
If “Mr.Smith" that is part of the value of the field is changed to
“Mr.Brown", do I have to create 1 million deletion queries
and updating queries in case where “Mr.Smith" appears in 1 million
documents?

Do we have a simple way of updating to use only 1 query?


Thanks,
Issei

-- 
Issei Nishigata

Re: How to replacing values on multiValued all together by using 1 query

Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/10/2018 7:51 AM, Issei Nishigata wrote:
> I create a field called employee_name, and use it as multiValued.
> If “Mr.Smith" that is part of the value of the field is changed to
> “Mr.Brown", do I have to create 1 million deletion queries
> and updating queries in case where “Mr.Smith" appears in 1 million
> documents?
>
> Do we have a simple way of updating to use only 1 query?

Solr is not a database.  There is no functionality to update field X on 
all documents that match a query.

If your index has a field designated as uniqueKey, you won't need to do 
a delete, you can just reindex those documents and Solr will do the 
delete for you.  If you do not have a uniqueKey, then you will need to 
delete the old document before indexing its replacement.

https://wiki.apache.org/solr/HowToReindex

If your index meets the criteria for Atomic Updates, then you could use 
the delete/add functionality in that feature to take care of it.  Solr 
will construct a complete document from your atomic update and all the 
data currently in the document, then index the new document, deleting 
the old one in the process. Atomic Updates also require a uniqueKey.

See this page for information on Atomic Updates and the field storage 
requirements:

https://lucene.apache.org/solr/guide/7_3/updating-parts-of-documents.html

Thanks,
Shawn