Class DataSourceService
java.lang.Object
fr.paris.lutece.plugins.elasticdata.service.DataSourceService
DataSourceService
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcompleteDataObjectWithFullData(DataSource dataSource, DataObject dataObject) Complete the data source with the external attributes and set elastic docuement idstatic voidcompleteDataObjectWithFullData(DataSource dataSource, List<DataObject> dataObjectList) Complete the data source with the external attributes and set elastic docuement idstatic voiddeleteById(DataSource dataSource, String strId) Delete a document based on its id in the indexstatic voiddeleteByQuery(DataSource dataSource, String strQuery) Delete a documents by Querystatic DataSourcegetDataSource(String strId) Get a Data Source from its IDstatic Collection<DataSource>Gets all data sources found into Spring context filesstatic fr.paris.lutece.plugins.libraryelastic.util.ElasticReturn elastic connectionstatic StringgetIdDocument(String strIdDataSource, String strIdDataObject) Return the unique id of the elastic documentstatic StringinsertDataAllDatasources(boolean bReset) Insert All data sourcesstatic StringinsertDataAllDatasources(boolean bReset, boolean bDaemon) Insert All data sourcesstatic intinsertObjects(fr.paris.lutece.plugins.libraryelastic.util.Elastic elastic, DataSource dataSource, Iterator<DataObject> iterateDataObjects) Insert a list of object in bulk modestatic voidpartialUpdate(DataSource dataSource, String strId, Object object) Partial Updates to Documentsstatic voidprocessFullIndexing(DataSource dataSource, boolean bReset) Insert data from a DataSource into Elastic Searchstatic voidprocessIncrementalIndexing(DataSource dataSource, DataObject dataObject) Insert one dataObject from a DataSource into Elastic Searchstatic voidprocessIncrementalIndexing(StringBuilder sbLogs, DataSource dataSource, Collection<DataObject> dataObject) Insert a dataObject from a DataSource into Elastic Searchstatic voidupdateIndexingStatus(DataSource dataSource, int nCount) Update indexing status of the datasource
-
Method Details
-
getDataSources
Gets all data sources found into Spring context files- Returns:
- The list
-
getDataSource
Get a Data Source from its ID- Parameters:
strId- The ID- Returns:
- The Data Source
-
processFullIndexing
Insert data from a DataSource into Elastic Search- Parameters:
dataSource- The data sourcebReset- if the index should be reset before inserting- Throws:
fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException- If an error occurs accessing to ElasticSearch
-
processIncrementalIndexing
public static void processIncrementalIndexing(DataSource dataSource, DataObject dataObject) throws fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException Insert one dataObject from a DataSource into Elastic Search- Parameters:
dataSource- The data sourcedataObject- The data object- Throws:
fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException- If an error occurs accessing to ElasticSearch
-
processIncrementalIndexing
public static void processIncrementalIndexing(StringBuilder sbLogs, DataSource dataSource, Collection<DataObject> dataObject) throws fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException Insert a dataObject from a DataSource into Elastic Search- Parameters:
sbLogs- A log bufferdataSource- The data sourcedataObject- The collection of data object- Throws:
fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException
-
partialUpdate
public static void partialUpdate(DataSource dataSource, String strId, Object object) throws fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException Partial Updates to Documents- Parameters:
dataSource- The data sourcestrId- The document idobject- The object- Throws:
fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException- Exception If an error occurs accessing to ElasticSearch
-
deleteByQuery
public static void deleteByQuery(DataSource dataSource, String strQuery) throws fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException Delete a documents by Query- Parameters:
dataSource- the data sourcestrQuery- the query- Throws:
fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException- Exception If an error occurs accessing to ElasticSearch
-
deleteById
public static void deleteById(DataSource dataSource, String strId) throws fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException Delete a document based on its id in the index- Parameters:
dataSource- The data sourcestrId- The id- Throws:
fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException- Exception If an error occurs accessing to ElasticSearch
-
insertDataAllDatasources
Insert All data sources- Parameters:
bReset- Reset the index before inserting- Returns:
- The logs of the process
- Throws:
fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException- If an error occurs accessing to ElasticSearch
-
insertDataAllDatasources
Insert All data sources- Parameters:
bReset- Reset the index before insertingbDaemon- If called by a daemon- Returns:
- The logs of the process
-
getElastic
public static fr.paris.lutece.plugins.libraryelastic.util.Elastic getElastic()Return elastic connection -
completeDataObjectWithFullData
Complete the data source with the external attributes and set elastic docuement id- Parameters:
dataSource- the data sourcedataObject- the data object
-
completeDataObjectWithFullData
public static void completeDataObjectWithFullData(DataSource dataSource, List<DataObject> dataObjectList) Complete the data source with the external attributes and set elastic docuement id- Parameters:
dataSource- the data sourcedataObjectList- the data object list
-
getIdDocument
Return the unique id of the elastic document- Parameters:
strIdDataSource- the data source idstrIdDataObject- the data object id
-
insertObjects
public static int insertObjects(fr.paris.lutece.plugins.libraryelastic.util.Elastic elastic, DataSource dataSource, Iterator<DataObject> iterateDataObjects) throws fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException Insert a list of object in bulk mode- Parameters:
elastic- The Elastic ServerdataSource- The data sourceiterateDataObjects- The iterator of objects- Returns:
- the number of documents posted
- Throws:
fr.paris.lutece.plugins.libraryelastic.util.ElasticClientException- If a problem occurs connecting the server
-
updateIndexingStatus
Update indexing status of the datasource- Parameters:
dataSource- the data sourcenCount- the count of objects processed
-