Hi;
Iam trying to update my index fields by using CId ; CId can be used many rows. My Structure like :
{
AId: 4244,
BId : 53535,
CId: "4242342"
}
if you look at below query what My intend to achieve, It returns to me a result what I desire.
POST usereventsreduced-*/_update_by_query
{
"script": {
"source": "ctx._source.AId = 1;",
"lang": "painless"
},
"query": {
"match": {
"CId": "b60d505f-baf6-4522-b2a3-659509435c29"
}
}
}
But I want to use above query in C# by using Nest. if you look at my below code , you will understand what I mean. But it didn't work.
Nest is really complicated and not easy to understand . how can I do that above query by writing Nest -C# ?
foreach (var pageview in pageviews)
{
var updateResponse = client.Update<object>("CId:${pageview.CId}", u => u
.Index(indexName)
.Script(s => s.Source("ctx._source.AId = params.AId")
.Lang("painless")
.Params(d => d
.Add("AId", pageview.AId)
)
)
);
Console.WriteLine(updateResponse.Result.ToString());
}
YOU HAVE TO BE CAREFUL!
it's not easy creating a class. Please don't do that. Because my index feeding from very dynamic fields MyClass can have 50 filelds 1 hot later 65 fieds.
Actually I don't want to use creating class ( AId, BId, CId, DId... etc.) because my fields are dynamic
Thanks for your help