I have been stucked in a scenario and not getting any proper solution. Here is the problem i am facing with Elasticsearch. Any help would be appriciated.
- I have two indexes one is video and another is subtitles. A video can have multiple chunks of subtitles which i am storing in subtitle index with video_id.
- Now when i search anything i want to search video title, description and its subtitle as well.
- But as far as i know ES does not supports Relational mapping. So i was not able to search subtitles as i need.
- Then i tried to store all the subtitles of a single video inside video index in form of nested array. But in long term a long video might have a lots of subtitles which will make my document more heavy and put performance impact.
- Please do consider that a single video's subtitle can be upto 1GB
So need your help in this to find a solution. Thank you.
Since ES is nonSQL, you won't get the relational searching feature. You have a few ways you can resolve this:
es.get(index="Video", id=video_id, _source_includes=["video_ description", "video_description"])and one to get the subtitleses.search(index="Subtitles", body={"query": {"match": {"video_id.keyword": video_id}}})["hits"]["hits"]. This was you will get video title, description and its subtitle. FYI,_source_includeswill only return those fields, this will give better performance in case document is large.PS: I am not sure what you are working on for which you required this but I would personally prefer the second way since trying to make the tables relational will end up costing performance.