For example, I have this structure
index/type1
which has item1 with mrp 20
like this {"item":"item1","mrp"20}
and on second type index/type2
which has item1 with mrp 10
like this {"item":"item1","mrp"20}
.
Now I need to add mrp of that item. which should be total of 40. Is it possible with elaticsearch ?
Not sure I follow this requirement exactly. You might want to take a look at the update API.
Thankyou for the link, that was helpful. What I wanted to know is , consider this SQL
select sum(mrp) from table1 join table2 where item="apple"
, just an example. Can this be achieved from ES?
you can do this with aggregations, search both indices, run a terms aggregation on the item and then have a sub aggregation, which sums up the mrp
field.
Sorry, but I have not become an expert yet . How do I search two indices at the same time ?
oh, thanks
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.