简体   繁体   中英

Which is the best way to index the data from relational database table of One to many relationship

Can you please let me know which is the best way to index the records in elastic search for my scenario.

My Scenario is :

1) Need to index around 40 million records from oracle table which has entries having one to many relationship records. And the uniqueness of the records is based on the composite key with 4 columns

2) After indexing , Search should support "full text search" on all the fields

3) Filters and sorting on selected fields needs to be supported.

After going through the official documentation i found couple of options , but want to know which approach would be most useful among below

1) For each record in table create a entry in the elastic index

2) Create a nested json object based on the composite key and then add this elastic index

3)Parent child Relationship mechanism and application side joins are not suitable for my scenario

Thanks

Girish TS

Your question is not particularly clear, here's how I understand it: you have 40M child records in one table, each with a reference to a parent record. You want to index your records so as to be able to search for a parent record whose children match certain criteria.

There are two solutions here:

  • Indexing one document per parent, with all children indexed as nested documents within the parent

  • Indexing each child record as a separate document, with a parent-child relationship in ElasticSearch

The first solution will have better performance, but it means that every time a child is updated, the full parent document must be reindexed with all its children.

In any case you're saying that a parent-child scheme is not suitable for your case, so you're left with only the first solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM