ElasticSearch displays two sql tables with foreign key

Suppose I have the following table:

`title`
- id
- name
- tv_series_id

Example:
id=1, name="Episode 2", tv_series_id=4

I can easily map this to ElasticSearch using the following JSON structure:

{
    "ID": 1,
    "Name": "Episode 2",
    "TVSeriesID": 4
}

If I then had a second table with a name tv_series, then in the table titlethat the foreign key refers to, for example:

`tv_series`
- id
- name

Example:
id=4, name='Friends'

How can I then map these relationships in Elasticsearch? Is there a general way by which two tables with one or more foreign key relationships can appear in Elasticsearch? For example, by performing a specific join operation?

+3
source share
1 answer

SQL , ( ), , / .

NoSQL Elasticsearch, , . (, parent-child ), JOIN.

, "" . . ( ):

  • / ?
  • ?

, , , JOIN :

{
    "ID": 1,
    "Name": "Episode 2",
    "TVSeriesID": 4,
    "TVSeriesName": "Friends"
}

, Friends 236 , , , .

+3

Source: https://habr.com/ru/post/1613131/


All Articles