Class ElasticsearchService

java.lang.Object
fr.paris.lutece.plugins.wiki.modules.ai.service.rag.ElasticsearchService
All Implemented Interfaces:
fr.paris.lutece.portal.service.init.ShutdownService, fr.paris.lutece.portal.service.util.LuteceService

@ApplicationScoped public class ElasticsearchService extends Object implements fr.paris.lutece.portal.service.init.ShutdownService
Service for managing Elasticsearch connections and embedding stores for wiki AI. Implements ShutdownService for proper resource cleanup.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
    Creates an embedding store for wiki content.
    void
    Creates the Elasticsearch index if it does not exist.
    co.elastic.clients.elasticsearch.ElasticsearchClient
    Gets the Elasticsearch client.
    Gets the index name.
     
    void
    Initializes the Elasticsearch clients after CDI construction, without talking to the server: anything that can fail is deferred to the first operation.
    void
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ElasticsearchService

      public ElasticsearchService()
  • Method Details

    • init

      @PostConstruct public void init()
      Initializes the Elasticsearch clients after CDI construction, without talking to the server: anything that can fail is deferred to the first operation.
    • createEmbeddingStore

      public dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment> createEmbeddingStore()
      Creates an embedding store for wiki content.
      Returns:
      the configured embedding store
    • getClient

      public co.elastic.clients.elasticsearch.ElasticsearchClient getClient()
      Gets the Elasticsearch client.
      Returns:
      the Elasticsearch client
    • getIndexName

      public String getIndexName()
      Gets the index name.
      Returns:
      the index name
    • createIndexIfNotExists

      public void createIndexIfNotExists()
      Creates the Elasticsearch index if it does not exist. Throws on failure.
    • getName

      public String getName()
      Specified by:
      getName in interface fr.paris.lutece.portal.service.util.LuteceService
    • process

      public void process()
      Specified by:
      process in interface fr.paris.lutece.portal.service.init.ShutdownService