Message Boards

ElasticSearch custom indexer

Dorian Penot, modified 5 Years ago.

ElasticSearch custom indexer

Junior Member Posts: 25 Join Date: 3/14/19 Recent Posts
Hi everyone, 

We managed to use indexers for our custom entities in our Service Builder, but we wanted to edit the "doGetDocument" method from User indexer, in order to get specific fields from search hits.

What is the best method to do so ? We tried a custom indexer, extending from BaseIndexer<User> but it is not implemented or called while reindexing.

Do we need to create a hook ? Is there any way to search a user and have specific JSON in hits ?

Thanks !
thumbnail
David H Nebinger, modified 5 Years ago.

RE: ElasticSearch custom indexer

Liferay Legend Posts: 14919 Join Date: 9/2/06 Recent Posts
You define an implementation of IndexPostProcessor. They will attach to an existing instance and is used to modify what that indexer does.
Dorian Penot, modified 5 Years ago.

RE: ElasticSearch custom indexer

Junior Member Posts: 25 Join Date: 3/14/19 Recent Posts
That's it ! Found out a tutorial and some examples on Github, and it is exactly what i need.

Thanks again !
thumbnail
Gnaniyar Zubair, modified 5 Years ago.

RE: ElasticSearch custom indexer

Liferay Master Posts: 722 Join Date: 12/19/07 Recent Posts
Would be great if you share those examples for other's reference. 
thumbnail
David H Nebinger, modified 5 Years ago.

RE: ElasticSearch custom indexer

Liferay Legend Posts: 14919 Join Date: 9/2/06 Recent Posts
The BLADE samples from github was the likely source: https://github.com/liferay/liferay-blade-samples