0
votes

I want to remove one specific value from a multivalued field in a large index, where I need to query first which documents contain that value, i.e.:

  1. retrieve IDs of the documents containing the specific value.
  2. partially update these documents (using remove).

Solr version is 5.1. I could update if necessary, but the change logs do not indicate any relevance to this issue.

I've tried the following query (in a few variations) on the /select endpoint through the Solr web interface (http://localhost:8983/solr/#/core/documents), trying to remove the value from all the documents:

{"id":"*", "field": {"remove":"value"} }

The server response is "success", but no document is updated.

What I could do is to query for field:value, extract the document IDs, and (programmatically) generate update queries for these IDs, similar to what has been indicated in this answer. But I would expect that there should be a more straight-forward solution.

The examples presented in the partial updates documentation and other related web pages are not really applicable here because they assume that the ID of the updated documents are known in advance. Most other discussions about similar issues refer to old Solr versions, before partial updates were introduced (in Solr 4).

1

1 Answers

0
votes

As far as I know, there is no "update by query" functionality in Solr at the current moment, so fetching and updating still is the suggested way.

Batching these updates (one select, one update) should however work as expected, reducing the number of requests made to Solr.