Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

297
Views
Sync data from two mysql tables with single Elasticsearch Index using Logstash

I have two mysql tables that I want to save into a single Elastic index.

Table 1: Product has id, name ... etc.

Table 2: ProductWarehouse has productId, warehouseId, qtyAvailable ... etc

Product one-to-many ProductWarehouse

My question is, how can I save ProductWarehouse records for each product as an array?

If ProductWarehouse was modified, how to reflect that on the Elastic index?

What is the best practice?

the Product index in Elastic should look like:

{
 "id",
 "name": ...,
 "warehouses": [
   {"warehouseId": 1, "qtyAvailable": 3},
   {"warehouseId": 10, "qtyAvailable": 30}
 ]
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

My suggestion is to create a MySQL view of the structure you need: Product joins with ProductWarehouse. This view just to use in Sync and then make the Sync from this view to ElasticSearch using Logstash.

Then you can use the ElasticSearsh Index as this structure:

{
 "id",
 "name": ...,
 "warehouses": 1
}
{
 "id",
 "name": ...,
 "warehouses": 3
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!