Is it possible to update nested field by query?


(Xudong You) #1

hi,
I am using update by query plugin
(https://github.com/yakaz/elasticsearch-action-updatebyquery/) to update
documents by query.
In my case, there is nested field in document, the mapping is something
like this:

        "mappings" : {

"mytype" : {
"properties" : {
"Myfield1" : {
"type" : "nested",
"properties" : {
"field1" : {
"type" : "string"
},
"field2" : {
"type" : "long"
}
}
},
"Title" : {
"type" : "string"
}
}
}
}

Then I want to update the nested field Myfield1 by query with following
request:

{
"query":{
"match":{"Title":"elasticsearch"}
},
"script" : "ctx._source.Myfield1 = [{'nestfield1':'foo
blabla...','nestfield2':100},{'nestfield1':'abc...','nestfield2':200}]"
}

But unfortunately, it does not work.

Does update by query support nested object?

BTW: any other ways to update document by query? Is the updatebyquery
plugin the only choice?

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/90a51ad5-ede4-45d1-bbe8-4cbbf219cc75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2