I'm studying Elastic search and trying to modeling with mysql tables. I have Mysql tables below for example.
Book Table
- id
- title
- abstract
- publisher_id
ex) book table
id | title | abstract | publisher_id
3 | book title A | A book about elastic search. | 12
Authors Table
- id
- name
- country
- book_id(id from Book table)
ex) authors table
id | name | country | book_id
1 | Alex | Korea | 3
2 | John | USA | 3
author could be more than one person.
Publisher Table
- id
- name
ex) publisher table
id | name
12 | Packt pub
In my thoughts, i could convert like below for elastic search index.
Book index
- id int
- title string
- abstract string
- authors array (id from Authors index. Authors could be more than one.)
- publisher int (id form publisher index)
Authors index
- id int
- name string
- country string
Publisher index
- id int
- name string
What i need to do is, search for Book title and abstract and get author's id. And then show authors list. For mysql, i would do like this.
Select * from authors where id in (select authors_id from book where match(title,abstract) against('${keyword}' IN BOOLEAN MODE))
How can i do this for elastic search? Is there a better way to modeling? and I also want to know how to query First search authors ids from book index and search with these ids from authors again?? or any other solution???