Reputation: 5601
I would like to use the UpdateByQuery() methode
If i understood well i need to give a query and a select.
for example i would like to change the name property to "welcome" in my proj class
I start to write my methode but i don't know what to do after that?
client.UpdateByQuery<proj>(q => q.Query(rq => rq.Term(f => f.idProjet, projetEntity.IdProjet)));
I don't see Update fluent methode in the intellisense helper
Could you help me please?
Upvotes: 1
Views: 2878
Reputation: 869
You need to use the Script
method. This example should work:
var scriptParams = new Dictionary<string, object> {{"newName", "welcome"}};
client.UpdateByQuery<proj>(q => q
.Query(rq => rq.Term(f => f.idProjet, projetEntity.IdProjet))
.Script(script => script
.Inline("ctx._source.name = newName;")
.Params(scriptParams)));
To run this example you have to set script.inline: true in elasticsearch.yml
. To avoid this you have to use File()
method instead of Inline()
.
Upvotes: 2