Dynamic attributes in elasticsearch index

Hi.
I have a huge EAV model and I need quickly search over any possible attributes.

So I want to know is it possible to construct elasticsearch index with dyn attributes?
If not, can you advise me some alternatives?

Thanks

Hi,

Out-of-the-box, the Search add-on doesn’t work with dynamic attributes.

You have to two options here:

Option 1. Implement indexing and searching behavior by yourself. You’ll need to define entity changes listeners and inside them update elasicsearch documents with the required information (values of “static” fields, dynamic fields and some reference to the entity). Or update ES index from the entity editor when the entity is saved. The same is for searching - you’ll need to perform a search in elasticsearch index, extract information about jmix entity from the search result and to display such entities. Actually that’s what Search add-on does, but only for “static” entity fields.

Option 2. You may try to supplement the search add-on functionality. You’ll probably need to track the changes of dynamic attribute entities (CategoryAttributeValue) and update existing elasticsearch documents created by the Search add-on with new fields containing dynamic attributes values. In this case, your ES documents will contain all the data. I’m not 100% sure, but it seems as the searching part of the Search add-on should search among all document fields, even among those that you added manually.