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, String orgId, User user) Adds or updates the event in the search index.addOrUpdateSeries(String id, Function<Optional<Series>, Optional<Series>> updateFunction, String orgId, User user) Adds or updates the series in the search index.addOrUpdateTheme(long id, Function<Optional<IndexTheme>, Optional<IndexTheme>> updateFunction, String orgId, User user) Adds or updates the theme in the search index.voidbulkEventUpdate(List<Event> eventList) 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.voidbulkThemeUpdate(List<IndexTheme> themeList) Adds or updates the themes in the search index.voidOSGi callback to deactivate this component.booleandeleteEvent(String eventId, String orgId) Delete event from index.booleandeleteSeries(String seriesId, String orgId) Delete series from index.booleandeleteTheme(String themeId, String orgId) Delete theme from index.getByQuery(EventSearchQuery query) getByQuery(SeriesSearchQuery query) getByQuery(ThemeSearchQuery query) String[]Returns an array of document types for the index.Loads the event from the search index if it exists.Loads the series from the search index if it exists.Loads the theme from the search index if it exists.voidOSGi callback for configuration changes.voidsetListProvidersService(ListProvidersService listProvidersService) voidunsetListProvidersService(ListProvidersService listProvidersService) 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
-
setListProvidersService
-
unsetListProvidersService
-
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, String 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, String 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
-
getTheme
public Optional<IndexTheme> getTheme(long themeId, String organization, User user) throws SearchIndexException Loads the theme from the search index if it exists.- Parameters:
themeId- The theme identifierorganization- The organizationuser- The user- Returns:
- the theme wrapped in an optional
- Throws:
SearchIndexException- If querying the search index failsIllegalStateException- If multiple themes with the same identifier are found
-
addOrUpdateEvent
public Optional<Event> addOrUpdateEvent(String id, Function<Optional<Event>, Optional<Event>> updateFunction, String orgId, 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 updatingorgId- The organization the event belongs touser- The user- Throws:
SearchIndexException- Thrown if unable to update the event.
-
bulkEventUpdate
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, String orgId, 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 updatingorgId- 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
-
addOrUpdateTheme
public Optional<IndexTheme> addOrUpdateTheme(long id, Function<Optional<IndexTheme>, Optional<IndexTheme>> updateFunction, String orgId, User user) throws SearchIndexExceptionAdds or updates the theme in the search index. Uses a locking mechanism to avoid issues like Lost Update.- Parameters:
id- The id of the theme to updateupdateFunction- The function that does the actual updatingorgId- The organization the theme belongs touser- The user- Throws:
SearchIndexException- Thrown if unable to update the theme.
-
bulkThemeUpdate
Adds or updates the themes in the search index.- Parameters:
themeList- The themes to update- Throws:
SearchIndexException- Thrown if unable to add or update the themes.
-
deleteEvent
Delete event from index.- Parameters:
eventId- The event identifierorgId- 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 identifierorgId- 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
-
deleteTheme
Delete theme from index.- Parameters:
themeId- The theme identifierorgId- 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.
-
getByQuery
- Parameters:
query- The query to use to retrieve the themes that match the query- Returns:
SearchResultcollection ofIndexThemefrom a query.- Throws:
SearchIndexException- Thrown if there is an error getting the results.
-