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,
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.
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.