I’m working on a query to be executed by Elasticsearch showing results on NReco PivotData microservice.
I make the query easier just for the example purpose.
There are two fields “anno” (year) and “mese” (month) and I need to sum them for each record.
This is what I’m using as a measure in the “appsettings.json” file:
{
"Name": "SumTry",
"LabelText": "SumTry",
"Type": "FirstValue",
"Params": ["{"script":{"source": "doc['anno'].value + doc['mese'].value"}}"]
}
This is the error I get. It seems that the “Name” field doesn’t work at all.
If I try to access the field differently:
{
"Name": "SumTry",
"LabelText": "SumTry",
"Type": "FirstValue",
"Params": ["{"script":{"source": "doc["anno"].value + doc["mese"].value"}}"]
}
I get this other error:
Any idea about how to solve it?
PS. I know I can use expressions, like the following one (it works), but I just want to test if there is any difference in performance between the two methods.
{
"Name": "anno",
"Type": "Sum",
"Params": [ "anno" ]
},
{
"Name": "mese",
"Type": "Sum",
"Params": [ "mese" ]
},
{
"Name": "SumTry",
"Type": "Expression",
"Params": [
"anno + mese",
"anno",
"mese"
]
}