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 -
Method Summary
Modifier and TypeMethodDescriptiondev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>Creates an embedding store for wiki content.voidCreates the Elasticsearch index if it does not exist.co.elastic.clients.elasticsearch.ElasticsearchClientGets the Elasticsearch client.Gets the index name.getName()voidinit()Initializes the Elasticsearch clients after CDI construction, without talking to the server: anything that can fail is deferred to the first operation.voidprocess()
-
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
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
- Specified by:
getNamein interfacefr.paris.lutece.portal.service.util.LuteceService
-
process
public void process()- Specified by:
processin interfacefr.paris.lutece.portal.service.init.ShutdownService
-