mysql - How to keep normalized models when searching via ElasticSearch? -
when setting mysql / elasticsearch combo, better to:
completely sync model information es (even non-search data), when result found, have information handy.
only sync searchable fields, , when results back, use
id
field find actual data in mysql database?
elasticsearch search engine. advise not use database system. suggest index search data , unique id database can retrieve results mysql using unique key returned elasticsearch. way you'll using both applications they're intended. elastic search not best querying relations , you'll have write lot more code operating on related data using mysql it.
also, don't want tie persistence layer search layer. these should independent possible, , change in 1 should not affect other, as possible. otherwise, you'll have update both systems if either has change. querying mysql on ids fast, can use , leave slow part (querying on full text) elastic search.
Comments
Post a Comment