Elastic Index data

I am trying to save data in to table which has relational mapping to another table.
Using a spring java jpa project. When the tables are updated with data it works fine but the elastic indexes are not updated with mapped data between the table. There is onetomany mapping through collection between two tables. The separate tables are indexed fine with data. Is there some specific settings for this in elastic setting which has to be done.

Welcome to our community! :smiley:
Where are these tables you refer to?

Hi Mark Walkom,
The tables are in MS SQL server DB. When there is an association in entities the indexing of elastic is not picking the assocoations automatically. I mean like for onetomany set. Is there some setting in elastic side which would do it automatically checking the IndexedEmbedded and annotations for indices and mappings in java side of project.

Correct, Elasticsearch is not a relational store like a database. You need to be explicit with mappings to create similar structures, eg parent/child.

The mappings are there with anootations like @IndexedEmbedded for @OneToMany with sets etc; But, when with these things in place when a new row is inserted in the db the elastic indexes are not updated with these references. Is there any way to do this apart from inserting the associated entries to the parent one . some configuration in elastic server or some setting in some elastic file etc?

I am not sure what you mean by those annotation references sorry.

These being used in entities and their fields which are to be indexed in elastic server.

The elasticsearch client does not use annotations as you described.
If you are using spring data elasticsearch or hibernate search, they might be used but I'm unsure.

I shared most of my thoughts there: http://david.pilato.fr/blog/2015/05/09/advanced-search-for-your-legacy-application/

Basically, I'd recommend modifying the application layer if possible and send data to elasticsearch in the same "transaction" as you are sending your data to the database.

Have also a look at this "live coding" recording.

Yes, not in the elastic search are these annotations. Using hibernate search in a spring JPA project.
Okay will go through the link you mentioned.

I went through the link you mentioned and it is very informative.
Regarding the elasticSearchDao you have created for updating or deleting indexes, is there some existing class in Hibernate Search which can be used for same purpose. If, data in particular index for a particular ID is to be deleted in addition to the data deleted from DB when several particular ID is deleted from SQL DB in application layer, will several delete method will also need to be ran for indexes. What is the best method to do this particular scenario. Please suggest.

You can use hibernate search with elasticsearch integration for that.
Otherwise you need to do everything "manually" just like I did in the demo.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.