Consistent search on two indexes - elasticsearch

前提是你 提交于 2021-01-29 14:10:55

问题


I have a product index and a store index. The product index includes documents that include the title and description fields of a product which are queried during search. The store index includes the id, price, and quantity of the product, in addition to the store locations.

I want to search for a product, get the documents, then retrieve all the stores that include all the resulted product ids and aggregate on them.

I have tried multiple options, but was not satisfied with the results:

Joins on parent

This approach was the best in terms of results consistency since all the stores could be linked to the parent document, but it was slower for large volume of stores.

Using two indexes

This approach was significantly faster on large volume of stores, but the results were inconsistent, since I had to duplicate the product title field for the store documents, while the product search query takes into account other fields, such as, description. I can duplicate all the fields used for the search query of the product in the store document, but that will create large documents with a lot of redundancy, while also having to make sure they are all up to date with the product document info.

来源:https://stackoverflow.com/questions/61883978/consistent-search-on-two-indexes-elasticsearch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!