Elasticsearch Match columns from different indexes with condition

I have 2 different indexes in elasticsearch, indx1

and indx2

which I indexed from SQL database using river plugin.

 indx1

----------
    id  |  Amt
    1      2
    2      3
    3      2   
    1      9 
    2      4 
----------

      

indx 2

----------
id   |  Name 
1       Alex
2       Joe
3       MARY


----------

      

I want to create a new index that calculates the average from indx1

and combines everything in one index. So the final index structure should look like

indx_final


----------
id | Name | Avg Amt | Status
1    Alex    5.5      High
2    Joe     3.5      Med
3    Mary    2.0      Low
----------

      

The status is set in accordance with the average value if Avg amt> 4, status = high, if avg amt> 3, status = Med, if avg amt <2.5, status = Low. Can this only be done in elasticsearch? If this is not possible, I will have to do the calculations in SQL and then index the data again.

Any help would be greatly appreciated. Thank!

+3
sql elasticsearch


source to share


No one has answered this question yet

Check out similar questions:

4331
What is the difference between "INNER JOIN" and "OUTER JOIN"?
1562
What's the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN?
894
Difference between JOIN and INNER JOIN
655
SQL excludes a column using SELECT * [except columnA] FROM tableA?
630
How to get column names from a table in SQL Server?
487
What is the difference between Left, Right, Outer and Inner Joins?
312
Removing data from ElasticSearch
211
List of all indexes on ElasticSearch server?
177
SQL JOIN and various types of JOINs
161
State within CREATION or WHERE



All Articles
Loading...
X
Show
Funny
Dev
Pics