Package org.opensearch.data.client.osc
Class OpenSearchTemplate
java.lang.Object
org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
org.opensearch.data.client.osc.OpenSearchTemplate
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.data.elasticsearch.core.DocumentOperations,org.springframework.data.elasticsearch.core.ElasticsearchOperations,org.springframework.data.elasticsearch.core.script.ScriptOperations,org.springframework.data.elasticsearch.core.SearchOperations
public class OpenSearchTemplate
extends org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
Implementation of
ElasticsearchOperations using the new
OpenSearch client.- Since:
- 4.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback interface to be used withexecute(OpenSearchTemplate.ClientCallback)for operating directly on theOpenSearchClient.Nested classes/interfaces inherited from class org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.DocumentCallback<T extends Object>, org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.ReadDocumentCallback<T extends Object>, org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.ReadSearchDocumentResponseCallback<T extends Object>, org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.ReadSearchScrollDocumentResponseCallback<T extends Object>, org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.SearchDocumentResponseCallback<T extends Object> -
Field Summary
Fields inherited from class org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
elasticsearchConverter, entityCallbacks, entityOperations, refreshPolicy, routingResolver -
Constructor Summary
ConstructorsConstructorDescriptionOpenSearchTemplate(org.opensearch.client.opensearch.OpenSearchClient client) OpenSearchTemplate(org.opensearch.client.opensearch.OpenSearchClient client, org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter elasticsearchConverter) -
Method Summary
Modifier and TypeMethodDescriptionvoidbulkUpdate(List<org.springframework.data.elasticsearch.core.query.UpdateQuery> queries, org.springframework.data.elasticsearch.core.query.BulkOptions bulkOptions, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) protected List<org.springframework.data.elasticsearch.core.IndexedObjectInformation>checkForBulkOperationFailure(org.opensearch.client.opensearch.core.BulkResponse bulkResponse) extract the list ofIndexedObjectInformationfrom aBulkResponse.closePointInTime(String pit) org.springframework.data.elasticsearch.core.cluster.ClusterOperationscluster()longcount(org.springframework.data.elasticsearch.core.query.Query query, Class<?> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) org.springframework.data.elasticsearch.core.query.ByQueryResponseorg.springframework.data.elasticsearch.core.query.ByQueryResponsedelete(org.springframework.data.elasticsearch.core.query.DeleteQuery query, Class<?> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) org.springframework.data.elasticsearch.core.query.ByQueryResponsedelete(org.springframework.data.elasticsearch.core.query.Query query, Class<?> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) booleandeleteScript(String name) List<org.springframework.data.elasticsearch.core.IndexedObjectInformation>doBulkOperation(List<?> queries, org.springframework.data.elasticsearch.core.query.BulkOptions bulkOptions, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) protected org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplatedoCopy()protected StringdoDelete(String id, String routing, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) protected booleandoIndex(org.springframework.data.elasticsearch.core.query.IndexQuery query, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates indexCoordinates) protected <T> org.springframework.data.elasticsearch.core.SearchHits<T>doSearch(org.springframework.data.elasticsearch.core.query.MoreLikeThisQuery query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) protected <T> org.springframework.data.elasticsearch.core.SearchHits<T>doSearch(org.springframework.data.elasticsearch.core.query.Query query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) protected <T> org.springframework.data.elasticsearch.core.SearchHits<T>doSearch(org.springframework.data.elasticsearch.core.query.SearchTemplateQuery query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) <T> Texecute(OpenSearchTemplate.ClientCallback<T> callback) Execute a callback with theOpenSearchClientand provide exception translation.<T> Tget(String id, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) org.springframework.data.elasticsearch.core.script.Scriptorg.springframework.data.elasticsearch.core.query.Queryorg.springframework.data.elasticsearch.core.IndexOperationsorg.springframework.data.elasticsearch.core.IndexOperationsindexOps(org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) org.springframework.data.elasticsearch.core.query.Query<T> List<org.springframework.data.elasticsearch.core.MultiGetItem<T>>multiGet(org.springframework.data.elasticsearch.core.query.Query query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) <T> List<org.springframework.data.elasticsearch.core.SearchHits<T>>multiSearch(List<? extends org.springframework.data.elasticsearch.core.query.Query> queries, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) List<org.springframework.data.elasticsearch.core.SearchHits<?>>multiSearch(List<? extends org.springframework.data.elasticsearch.core.query.Query> queries, List<Class<?>> classes) List<org.springframework.data.elasticsearch.core.SearchHits<?>>multiSearch(List<? extends org.springframework.data.elasticsearch.core.query.Query> queries, List<Class<?>> classes, List<org.springframework.data.elasticsearch.core.mapping.IndexCoordinates> indexes) List<org.springframework.data.elasticsearch.core.SearchHits<?>>multiSearch(List<? extends org.springframework.data.elasticsearch.core.query.Query> queries, List<Class<?>> classes, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) openPointInTime(org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index, Duration keepAlive, Boolean ignoreUnavailable) booleanputScript(org.springframework.data.elasticsearch.core.script.Script script) org.springframework.data.elasticsearch.core.query.BaseQueryBuilderqueryBuilderWithIds(List<String> ids) org.springframework.data.elasticsearch.core.reindex.ReindexResponsereindex(org.springframework.data.elasticsearch.core.reindex.ReindexRequest reindexRequest) <T> org.springframework.data.elasticsearch.core.SearchHits<T>search(org.springframework.data.elasticsearch.core.query.Query query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) voidsearchScrollClear(List<String> scrollIds) <T> org.springframework.data.elasticsearch.core.SearchScrollHits<T>searchScrollContinue(String scrollId, long scrollTimeInMillis, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) <T> org.springframework.data.elasticsearch.core.SearchScrollHits<T>searchScrollStart(long scrollTimeInMillis, org.springframework.data.elasticsearch.core.query.Query query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) submitReindex(org.springframework.data.elasticsearch.core.reindex.ReindexRequest reindexRequest) org.springframework.data.elasticsearch.core.query.UpdateResponseupdate(org.springframework.data.elasticsearch.core.query.UpdateQuery updateQuery, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) org.springframework.data.elasticsearch.core.query.ByQueryResponseupdateByQuery(org.springframework.data.elasticsearch.core.query.UpdateQuery updateQuery, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) Methods inherited from class org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
buildUpdateQueryByEntity, bulkIndex, bulkIndex, bulkIndex, bulkOperation, bulkUpdate, count, delete, delete, delete, delete, delete, exists, exists, get, getElasticsearchConverter, getEntityCreator, getEntityRouting, getIndexCoordinatesFor, getRefreshPolicy, index, logVersions, maybeCallbackAfterConvert, maybeCallbackAfterLoad, maybeCallbackAfterSave, maybeCallbackAfterSaveWithQueries, maybeCallbackAfterSaveWithQuery, maybeCallbackBeforeConvert, maybeCallbackBeforeConvertWithQueries, maybeCallbackBeforeConvertWithQuery, multiGet, multiSearch, save, save, save, save, save, search, search, search, searchForStream, searchForStream, searchScrollClear, setApplicationContext, setEntityCallbacks, setRefreshPolicy, toArray, update, update, updateIndexedObjectsWithQueries, withRefreshPolicy, withRoutingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.elasticsearch.core.DocumentOperations
bulkIndex, bulkUpdateMethods inherited from interface org.springframework.data.elasticsearch.core.ElasticsearchOperations
convertIdMethods inherited from interface org.springframework.data.elasticsearch.core.SearchOperations
count, openPointInTime, searchOne, searchOne
-
Constructor Details
-
OpenSearchTemplate
public OpenSearchTemplate(org.opensearch.client.opensearch.OpenSearchClient client) -
OpenSearchTemplate
public OpenSearchTemplate(org.opensearch.client.opensearch.OpenSearchClient client, org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter elasticsearchConverter)
-
-
Method Details
-
doCopy
protected org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate doCopy()- Specified by:
doCopyin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
indexOps
-
indexOps
public org.springframework.data.elasticsearch.core.IndexOperations indexOps(org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
cluster
public org.springframework.data.elasticsearch.core.cluster.ClusterOperations cluster() -
get
-
multiGet
-
bulkUpdate
public void bulkUpdate(List<org.springframework.data.elasticsearch.core.query.UpdateQuery> queries, org.springframework.data.elasticsearch.core.query.BulkOptions bulkOptions, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
delete
public org.springframework.data.elasticsearch.core.query.ByQueryResponse delete(org.springframework.data.elasticsearch.core.query.DeleteQuery query, Class<?> clazz) -
delete
public org.springframework.data.elasticsearch.core.query.ByQueryResponse delete(org.springframework.data.elasticsearch.core.query.DeleteQuery query, Class<?> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
delete
public org.springframework.data.elasticsearch.core.query.ByQueryResponse delete(org.springframework.data.elasticsearch.core.query.Query query, Class<?> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
update
public org.springframework.data.elasticsearch.core.query.UpdateResponse update(org.springframework.data.elasticsearch.core.query.UpdateQuery updateQuery, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
updateByQuery
public org.springframework.data.elasticsearch.core.query.ByQueryResponse updateByQuery(org.springframework.data.elasticsearch.core.query.UpdateQuery updateQuery, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
doIndex
public String doIndex(org.springframework.data.elasticsearch.core.query.IndexQuery query, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates indexCoordinates) - Specified by:
doIndexin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
doExists
protected boolean doExists(String id, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) - Specified by:
doExistsin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
doDelete
protected String doDelete(String id, @Nullable String routing, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) - Specified by:
doDeletein classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
reindex
public org.springframework.data.elasticsearch.core.reindex.ReindexResponse reindex(org.springframework.data.elasticsearch.core.reindex.ReindexRequest reindexRequest) -
submitReindex
public String submitReindex(org.springframework.data.elasticsearch.core.reindex.ReindexRequest reindexRequest) -
doBulkOperation
public List<org.springframework.data.elasticsearch.core.IndexedObjectInformation> doBulkOperation(List<?> queries, org.springframework.data.elasticsearch.core.query.BulkOptions bulkOptions, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) - Specified by:
doBulkOperationin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
getClusterVersion
- Specified by:
getClusterVersionin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
getVendor
- Specified by:
getVendorin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
getRuntimeLibraryVersion
- Specified by:
getRuntimeLibraryVersionin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
count
public long count(org.springframework.data.elasticsearch.core.query.Query query, @Nullable Class<?> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
search
public <T> org.springframework.data.elasticsearch.core.SearchHits<T> search(org.springframework.data.elasticsearch.core.query.Query query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
doSearch
protected <T> org.springframework.data.elasticsearch.core.SearchHits<T> doSearch(org.springframework.data.elasticsearch.core.query.Query query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
doSearch
protected <T> org.springframework.data.elasticsearch.core.SearchHits<T> doSearch(org.springframework.data.elasticsearch.core.query.SearchTemplateQuery query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) -
doSearch
protected <T> org.springframework.data.elasticsearch.core.SearchHits<T> doSearch(org.springframework.data.elasticsearch.core.query.MoreLikeThisQuery query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) - Specified by:
doSearchin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
searchScrollStart
public <T> org.springframework.data.elasticsearch.core.SearchScrollHits<T> searchScrollStart(long scrollTimeInMillis, org.springframework.data.elasticsearch.core.query.Query query, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) - Specified by:
searchScrollStartin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
searchScrollContinue
public <T> org.springframework.data.elasticsearch.core.SearchScrollHits<T> searchScrollContinue(String scrollId, long scrollTimeInMillis, Class<T> clazz, org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index) - Specified by:
searchScrollContinuein classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
searchScrollClear
- Specified by:
searchScrollClearin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
multiSearch
-
multiSearch
-
multiSearch
-
multiSearch
-
openPointInTime
public String openPointInTime(org.springframework.data.elasticsearch.core.mapping.IndexCoordinates index, Duration keepAlive, Boolean ignoreUnavailable) - Specified by:
openPointInTimein interfaceorg.springframework.data.elasticsearch.core.SearchOperations- Overrides:
openPointInTimein classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
closePointInTime
- Specified by:
closePointInTimein interfaceorg.springframework.data.elasticsearch.core.SearchOperations- Overrides:
closePointInTimein classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
putScript
public boolean putScript(org.springframework.data.elasticsearch.core.script.Script script) - Specified by:
putScriptin interfaceorg.springframework.data.elasticsearch.core.script.ScriptOperations- Overrides:
putScriptin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
getScript
- Specified by:
getScriptin interfaceorg.springframework.data.elasticsearch.core.script.ScriptOperations- Overrides:
getScriptin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
deleteScript
- Specified by:
deleteScriptin interfaceorg.springframework.data.elasticsearch.core.script.ScriptOperations- Overrides:
deleteScriptin classorg.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate
-
execute
Execute a callback with theOpenSearchClientand provide exception translation.- Type Parameters:
T- the type returned from the callback- Parameters:
callback- the callback to execute, must not be null- Returns:
- the callback result
-
matchAllQuery
public org.springframework.data.elasticsearch.core.query.Query matchAllQuery() -
idsQuery
-
queryBuilderWithIds
-
checkForBulkOperationFailure
protected List<org.springframework.data.elasticsearch.core.IndexedObjectInformation> checkForBulkOperationFailure(org.opensearch.client.opensearch.core.BulkResponse bulkResponse) extract the list ofIndexedObjectInformationfrom aBulkResponse.- Parameters:
bulkResponse- the response to evaluate- Returns:
- the list of the
IndexedObjectInformations
-