Class ElasticsearchIndex
java.lang.Object
org.opencastproject.elasticsearch.impl.AbstractElasticsearchIndex
org.opencastproject.elasticsearch.index.ElasticsearchIndex
- All Implemented Interfaces:
SearchIndex
An index implementation based on ElasticSearch that serves the Admin UI API and the External API with data
aggregated from multiple services.
-
Field Summary
Fields inherited from class org.opencastproject.elasticsearch.impl.AbstractElasticsearchIndex
ELASTICSEARCH_PASSWORD_KEY, ELASTICSEARCH_SERVER_HOSTNAME_KEY, ELASTICSEARCH_SERVER_PORT_KEY, ELASTICSEARCH_SERVER_SCHEME_KEY, ELASTICSEARCH_USERNAME_KEY, indexSettingsPath -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidOSGi callback to activate this component instance.addOrUpdateEvent(String id, Function<Optional<Event>, Optional<Event>> updateFunction, Organization organization, User user) Adds or updates the event in the search index.addOrUpdateSeries(String id, Function<Optional<Series>, Optional<Series>> updateFunction, Organization organization, User user) Adds or updates the series in the search index.voidbulkEventUpdate(List<Event> eventList, Organization organization) Adds the recording events to the search index or updates it accordingly if it is there.voidbulkSeriesUpdate(List<Series> seriesList) Add or update a range of series in the search index.voidOSGi callback to deactivate this component.booleandeleteEvent(String eventId, Organization organization) Delete event from index.booleandeleteSeries(String seriesId, Organization organization) Delete series from index.getByQuery(EventSearchQuery query) getByQuery(SeriesSearchQuery query) String[]Returns an array of document types for the index.getEvent(String mediaPackageId, Organization organization, User user) Loads the event from the search index if it exists.getSeries(String seriesId, Organization organization, User user) Loads the series from the search index if it exists.voidOSGi callback for configuration changes.Methods inherited from class org.opencastproject.elasticsearch.impl.AbstractElasticsearchIndex
activate, bulkUpdate, clear, close, delete, executeQuery, getClient, getIndexName, getIndexVersion, getSearchRequest, getSubIndexIdentifier, getTermsForField, getTotalHits, init, update
-
Constructor Details
-
ElasticsearchIndex
public ElasticsearchIndex()
-
-
Method Details
-
activate
public void activate(org.osgi.framework.BundleContext bundleContext, Map<String, Object> properties) throws org.osgi.service.component.ComponentExceptionOSGi callback to activate this component instance.- Parameters:
bundleContext- The bundle contextproperties- The configuration- Throws:
org.osgi.service.component.ComponentException- If the search index cannot be initialized
-
deactivate
OSGi callback to deactivate this component.- Throws:
IOException- If closing the index fails
-
modified
OSGi callback for configuration changes.- Overrides:
modifiedin classAbstractElasticsearchIndex- Parameters:
properties- The configuration
-
getDocumentTypes
Description copied from class:AbstractElasticsearchIndexReturns an array of document types for the index. For every one of these, the corresponding document type definition will be loaded.- Specified by:
getDocumentTypesin classAbstractElasticsearchIndex- Returns:
- the document types
- See Also:
-
getEvent
public Optional<Event> getEvent(String mediaPackageId, Organization organization, User user) throws SearchIndexException Loads the event from the search index if it exists.- Parameters:
mediaPackageId- The media package identifierorganization- The organizationuser- The user- Returns:
- the event (optional)
- Throws:
SearchIndexException- If querying the search index failsIllegalStateException- If multiple events with the same identifier are found
-
getSeries
public Optional<Series> getSeries(String seriesId, Organization organization, User user) throws SearchIndexException Loads the series from the search index if it exists.- Parameters:
seriesId- The series identifierorganization- The organizationuser- The user- Returns:
- the series (optional)
- Throws:
SearchIndexException- If querying the search index failsIllegalStateException- If multiple series with the same identifier are found
-
addOrUpdateEvent
public Optional<Event> addOrUpdateEvent(String id, Function<Optional<Event>, Optional<Event>> updateFunction, Organization organization, User user) throws SearchIndexExceptionAdds or updates the event in the search index. Uses a locking mechanism to avoid issues like Lost Update.- Parameters:
id- The id of the event to updateupdateFunction- The function that does the actual updatingorganization- The organization the event belongs touser- The user- Throws:
SearchIndexException- Thrown if unable to update the event.
-
bulkEventUpdate
public void bulkEventUpdate(List<Event> eventList, Organization organization) throws SearchIndexException Adds the recording events to the search index or updates it accordingly if it is there.- Parameters:
eventList- The events to update- Throws:
SearchIndexException- If the events cannot be added or updated
-
addOrUpdateSeries
public Optional<Series> addOrUpdateSeries(String id, Function<Optional<Series>, Optional<Series>> updateFunction, Organization organization, User user) throws SearchIndexExceptionAdds or updates the series in the search index. Uses a locking mechanism to avoid issues like Lost Update.- Parameters:
id- The id of the series to addupdateFunction- The function that does the actual updatingorganization- The organization the series belongs touser- The user- Throws:
SearchIndexException- Thrown if unable to add or update the series.
-
bulkSeriesUpdate
Add or update a range of series in the search index.- Parameters:
seriesList- The series to update- Throws:
SearchIndexException- If the series cannot be added or updated
-
deleteEvent
Delete event from index.- Parameters:
eventId- The event identifierorganization- The organization id- Returns:
- true if it was deleted, false if it couldn't be found
- Throws:
SearchIndexException- If there was an error during deletion
-
deleteSeries
Delete series from index.- Parameters:
seriesId- The series identifierorganization- The organization id- Returns:
- true if it was deleted, false if it couldn't be found
- Throws:
SearchIndexException- If there was an error during deletion
-
getByQuery
- Parameters:
query- The query to use to retrieve the events that match the query- Returns:
SearchResultcollection ofEventfrom a query.- Throws:
SearchIndexException- Thrown if there is an error getting the results.
-
getByQuery
- Parameters:
query- The query to use to retrieve the series that match the query- Returns:
SearchResultcollection ofSeriesfrom a query.- Throws:
SearchIndexException- Thrown if there is an error getting the results.
-