I have my input data from a table. The table data looks like
<Customer_id> <Item_id> <Item name>
. For every item brought by customer, there is a separate row in the table. For example, if c1 buys i1,i2,i3,i4,i5 It will have 5 rows in the table.
Now the data that I want to insert into elasticsearch is in this some way:
{
"c1": [
{
"item_id": "i1",
"item_name": "ABC"
},
{
"item_id": "i2",
"item_name": "XYZ"
},
.....
],
"c2": [
{
"item_id": 4,
"item_name": "PQR"
}
]
}
How can I modify the input as above in logstash ?
Also my schema looks like this :
Item : item_id , item_name
Buy: cust_id, item_id
Also Can you please suggest the SQL query to be made in order to get the above output?