You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Vince McMahon <si...@gmail.com> on 2023/10/25 14:44:29 UTC
deleting documents based on matching value of the field
Hi,
Could someone provide me a few examples on the syntax for delete a few
documents based on matching (or actually partial matching) of a value of a
a field.
for example, delete all document is: *:*
I have some of the documents that has a kv pairs liked:
"my_field":"value1"
"my_field":"value2"
"my_field":"value3"
only the document with value2 needs to be deleted.
What is the syntax to delete by partial matching value of a field?
Thanks.
Re: deleting documents based on matching value of the field
Posted by Surya R <su...@gmail.com>.
Hello Vince, we use something in this format to delete by "id", basically
try changing the query to a pattern and test in your sandbox. We use
leader/follower architecture.
curl "http://solr-host:8983/solr/core/deletes?commit=true" -H
"Content-Type:text/xml" --data-binary
'<delete><query>id:12233</query></delete>'
In case the id is negative, you have to escape the minus sign.
We have a shell script that deletes ids in bulk once in a while and the
above statement works perfectly fine. Our requirement is to delete by id,
but I am confident the pattern would work too.
Surya
On Wed, Oct 25, 2023 at 10:44 AM Vince McMahon <
sippingonesandzeros@gmail.com> wrote:
> Hi,
>
> Could someone provide me a few examples on the syntax for delete a few
> documents based on matching (or actually partial matching) of a value of a
> a field.
>
> for example, delete all document is: *:*
>
> I have some of the documents that has a kv pairs liked:
> "my_field":"value1"
> "my_field":"value2"
> "my_field":"value3"
>
> only the document with value2 needs to be deleted.
>
> What is the syntax to delete by partial matching value of a field?
>
> Thanks.
>
--
-- Surya