Here is the sample data:
In the type blog_comments
, I have some comments data, whose structure like this:
{"blog_id": 1, "comments": "Apple", "comment_id": 1}
And for #1
and #2
blog, there are 6 comments in this type blog_comments
totally:
{"blog_id": 1, "comments": "Apple", "comment_id": 1}
{"blog_id": 1, "comments": "Orange", "comment_id": 2}
{"blog_id": 1, "comments": "Fruit", "comment_id": 3}
{"blog_id": 2, "comments": "Apple", "comment_id": 1}
{"blog_id": 2, "comments": "Orange", "comment_id": 2}
{"blog_id": 2, "comments": "Earth", "comment_id": 3}
Question: Is it possible using some "magic" queries to get
#1as the result when I searching "Apple Fruit" and get
#2when I search "Apple Earth" ?
I'm considering that joining all comments to one new record (in new type) for each blog then do the search on this new type. But there are too many comments (about 12,000,000 comments), and these comments had already been indexed into the elasticsearch search, so it would be better to use these data as much as possible.