Get value of a list


#1

Hello everyone,
I would like to create a query wich match with a scpecific date and take the price to divide it between the sqm field.
In other words,lets imagine that I have this doc
....
"historic": [ { "date": "2016-10-30","price": 161000, "sqm":54}, { "date": "2016-05-30","price": 113000, "sqm":55}]
....

So I would like to look for "date": "2016-05-30" and take its price / sqm = 113000/55 --> and put it in another variable. I know how to do the match but I guess that I need a Script formula in order to get the avg amount,

Any ideas? Thanks to all


(Alexander Reelsen) #2

Hey,

while you might be able to use a script field - I would highly recommend you to do that calculation at index, for example you could use a script processor for that. This means you document will be enriched with that field before it is being indexed.

--Alex


#3

I am using an aggregation and the agg /sum got the amount that I set in the match by itself (awesome) . Unfortunately, It doesnt happen when I use a simple match (without agg) so I created a for loop in order to get the value that I am looking for.


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.