Deleting a field / subdocument from ES index document

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Deleting a field / subdocument from ES index document

Anurag Choudhary
Suppose I have following document indexed in ES

{
    Column1 : "Value1",
    Column2 : "Value2
}

Later if there is a change in document and Column2 is deleted. How can I use the Update API to delete this particular field ? All the examples that I found on net talk about adding a new field, or updating value of a field in JSON document.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/850b5eaa-3887-4e04-b042-9ac85faac18e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Deleting a field / subdocument from ES index document

Glen Smith
You re-index the document by its ID.

On Wednesday, July 9, 2014 6:46:51 PM UTC-4, Anurag Choudhary wrote:
Suppose I have following document indexed in ES

{
    Column1 : "Value1",
    Column2 : "Value2
}

Later if there is a change in document and Column2 is deleted. How can I use the Update API to delete this particular field ? All the examples that I found on net talk about adding a new field, or updating value of a field in JSON document.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ec9ddcc2-b01a-4b6a-add4-46435f6d9703%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Deleting a field / subdocument from ES index document

Anurag Choudhary

Reindex would require the application to get the full new document. Since in my case the changes are incremental (like delete a field or add a field), I will have to re-read the full contents to reindex.

I found following update operation which can remove a field from the document. It uses script to do this. My questions is can this be done without script using pure Java API. The reason I am trying to avoid script is because it is disabled by default.

We can also remove a field from the document:

curl -XPOST 'localhost:9200/test/type1/1/_update' -d '{
   
"script" : "ctx._source.remove(\"text\")"
}'


On Wed, Jul 9, 2014 at 8:36 PM, Glen Smith <[hidden email]> wrote:
You re-index the document by its ID.


On Wednesday, July 9, 2014 6:46:51 PM UTC-4, Anurag Choudhary wrote:
Suppose I have following document indexed in ES

{
    Column1 : "Value1",
    Column2 : "Value2
}

Later if there is a change in document and Column2 is deleted. How can I use the Update API to delete this particular field ? All the examples that I found on net talk about adding a new field, or updating value of a field in JSON document.

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/6Xbg7jg_w14/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ec9ddcc2-b01a-4b6a-add4-46435f6d9703%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CANWBWsXR0vXEWeMSyRuKJWSb%2BH4FYMWruzodkf9SQbXmLFqcgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.