I am new to elasticsearch, and trying to evaluate if my sql query can be migrated to elastic search.
-
Is it possible to write an elasticsearch query that returns calculations performed using multiple fields in a document?
Ex: if I have a document like {"salary": 100000, "spouse_salary":200000} , I want the query result to give me a field called total_salary with a value of salary+spouse_salary (300000 in this case) -
Is it possible to perform calculations as stated above but with also user supplied parameters into the mix?
Ex: If the tax on the salary needs to be calculated before the results are returned, and the tax % is passed in the query(I am not sure how though, is there a way to do that ? ), If i pass .05 as tax_rate to the query, i want a response like total_tax = 300000 * .05
I have skimmed through the documentation, but most of the aggregations/calculations appear to be on a single field like sum of salary, avg of salary etc, but couldn't find calculations using multiple fields, like salary+spouse_salary
Any pointers is appreciated.