Search code examples
elasticsearchmoqui

Indexing documents - do I have to run the refresh index service to maintain the indices?


I am using ElasticSearch in Moqui. DataDocument and Feed documents are set, everything is working. Except for the situation when I restart the server. I need to run the org.moqui.search.SearchServices.index#DataFeedDocuments service. Does this means that the indices are stored in-memory? And I have to restore them by running the service?

I also set up the Real-time Service Push [DTFDTP_RT_PUSH] service for MantleProduct. Does this service only take care of refreshing when individual entities are modified?


Solution

  • Yes, a real-time push DataFeed is just for that purpose, ie to generate a new 'document' (JSON document, though internally nested Map and List objects) based on the DataDocument definitions associated with the DataFeed and call the service on the DataFeed with them. The indexing service then takes those and indexes them in ElasticSearch. Other services can be used for different things such as sending notifications.

    The index documents are persisted in ElasticSearch unless you delete its files. If something in the way you are restarting the server deletes the ElasticSearch files then you'll have to use the Data Document Index screen in the System app to tell it to re-index all documents based on database records.