public interface ElasticsearchOperations
Modifier and Type | Method and Description |
---|---|
Boolean |
addAlias(AliasQuery query)
adding new alias
|
void |
bulkIndex(List<IndexQuery> queries)
Bulk index all objects.
|
void |
bulkUpdate(List<UpdateQuery> queries)
Bulk update all objects.
|
<T> void |
clearScroll(String scrollId)
Clears the search contexts associated with specified scroll ids.
|
<T> long |
count(CriteriaQuery query)
return number of elements found by given query
|
<T> long |
count(CriteriaQuery query,
Class<T> clazz)
return number of elements found by given query
|
<T> long |
count(SearchQuery query)
return number of elements found by given query
|
<T> long |
count(SearchQuery query,
Class<T> clazz)
return number of elements found by given query
|
<T> boolean |
createIndex(Class<T> clazz)
Create an index for a class
|
<T> boolean |
createIndex(Class<T> clazz,
Object settings)
Create an index for given class and Settings
|
boolean |
createIndex(String indexName)
Create an index for given indexName
|
boolean |
createIndex(String indexName,
Object settings)
Create an index for given indexName and Settings
|
<T> String |
delete(Class<T> clazz,
String id)
Delete the one object with provided id
|
<T> void |
delete(CriteriaQuery criteriaQuery,
Class<T> clazz)
Delete all records matching the criteria
|
void |
delete(DeleteQuery query)
Delete all records matching the query
|
<T> void |
delete(DeleteQuery query,
Class<T> clazz)
Delete all records matching the query
|
String |
delete(String indexName,
String type,
String id)
Delete the one object with provided id
|
<T> boolean |
deleteIndex(Class<T> clazz)
Deletes an index for given entity
|
boolean |
deleteIndex(String indexName)
Deletes an index for given indexName
|
org.elasticsearch.client.Client |
getClient() |
ElasticsearchConverter |
getElasticsearchConverter() |
<T> Map |
getMapping(Class<T> clazz)
Get mapping for a class
|
Map |
getMapping(String indexName,
String type)
Get mapping for a given indexName and type
|
ElasticsearchPersistentEntity |
getPersistentEntityFor(Class clazz) |
<T> Map |
getSetting(Class<T> clazz)
Get settings for a given class
|
Map |
getSetting(String indexName)
Get settings for a given indexName
|
String |
index(IndexQuery query)
Index an object.
|
<T> boolean |
indexExists(Class<T> clazz)
check if index is exists
|
boolean |
indexExists(String indexName)
check if index is exists for given IndexName
|
<T> Page<T> |
moreLikeThis(MoreLikeThisQuery query,
Class<T> clazz)
more like this query to search for documents that are "like" a specific document.
|
<T> LinkedList<T> |
multiGet(SearchQuery searchQuery,
Class<T> clazz)
Execute a multiGet against elasticsearch for the given ids
|
<T> LinkedList<T> |
multiGet(SearchQuery searchQuery,
Class<T> clazz,
MultiGetResultMapper multiGetResultMapper)
Execute a multiGet against elasticsearch for the given ids with MultiGetResultMapper
|
<T> boolean |
putMapping(Class<T> clazz)
Create mapping for a class
|
<T> boolean |
putMapping(Class<T> clazz,
Object mappings)
Create mapping for a class
|
boolean |
putMapping(String indexName,
String type,
Object mappings)
Create mapping for a given indexName and type
|
<T> T |
query(SearchQuery query,
ResultsExtractor<T> resultsExtractor) |
List<org.elasticsearch.cluster.metadata.AliasMetaData> |
queryForAlias(String indexName)
get all the alias pointing to specified index
|
<T> List<String> |
queryForIds(SearchQuery query)
Execute the query against elasticsearch and return ids
|
<T> List<T> |
queryForList(CriteriaQuery query,
Class<T> clazz)
Execute the criteria query against elasticsearch and return result as
List |
<T> List<T> |
queryForList(SearchQuery query,
Class<T> clazz)
Execute the search query against elasticsearch and return result as
List |
<T> List<T> |
queryForList(StringQuery query,
Class<T> clazz)
Execute the string query against elasticsearch and return result as
List |
<T> T |
queryForObject(CriteriaQuery query,
Class<T> clazz)
Execute the query against elasticsearch and return the first returned object
|
<T> T |
queryForObject(GetQuery query,
Class<T> clazz)
Execute the query against elasticsearch and return the first returned object
|
<T> T |
queryForObject(GetQuery query,
Class<T> clazz,
GetResultMapper mapper)
Execute the query against elasticsearch and return the first returned object using custom mapper
|
<T> T |
queryForObject(StringQuery query,
Class<T> clazz)
Execute the query against elasticsearch and return the first returned object
|
<T> Page<T> |
queryForPage(CriteriaQuery query,
Class<T> clazz)
Execute the query against elasticsearch and return result as
Page |
<T> Page<T> |
queryForPage(SearchQuery query,
Class<T> clazz)
Execute the query against elasticsearch and return result as
Page |
<T> Page<T> |
queryForPage(SearchQuery query,
Class<T> clazz,
SearchResultMapper mapper)
Execute the query against elasticsearch and return result as
Page using custom mapper |
<T> Page<T> |
queryForPage(StringQuery query,
Class<T> clazz)
Execute the query against elasticsearch and return result as
Page |
<T> Page<T> |
queryForPage(StringQuery query,
Class<T> clazz,
SearchResultMapper mapper)
Execute the query against elasticsearch and return result as
Page using custom mapper |
<T> void |
refresh(Class<T> clazz)
refresh the index
|
void |
refresh(String indexName)
refresh the index
|
Boolean |
removeAlias(AliasQuery query)
removing previously created alias
|
String |
scan(CriteriaQuery query,
long scrollTimeInMillis,
boolean noFields)
Returns scroll id for criteria query
|
<T> String |
scan(CriteriaQuery query,
long scrollTimeInMillis,
boolean noFields,
Class<T> clazz)
Returns scroll id for criteria query
|
String |
scan(SearchQuery query,
long scrollTimeInMillis,
boolean noFields)
Returns scroll id for scan query
|
<T> String |
scan(SearchQuery query,
long scrollTimeInMillis,
boolean noFields,
Class<T> clazz)
Returns scroll id for scan query
|
<T> Page<T> |
scroll(String scrollId,
long scrollTimeInMillis,
Class<T> clazz)
Scrolls the results for give scroll id
|
<T> Page<T> |
scroll(String scrollId,
long scrollTimeInMillis,
SearchResultMapper mapper)
Scrolls the results for give scroll id using custom result mapper
|
<T> CloseableIterator<T> |
stream(CriteriaQuery query,
Class<T> clazz)
Executes the given
CriteriaQuery against elasticsearch and return result as CloseableIterator . |
<T> CloseableIterator<T> |
stream(SearchQuery query,
Class<T> clazz)
Executes the given
SearchQuery against elasticsearch and return result as CloseableIterator . |
<T> CloseableIterator<T> |
stream(SearchQuery query,
Class<T> clazz,
SearchResultMapper mapper)
Executes the given
SearchQuery against elasticsearch and return result as CloseableIterator using custom mapper. |
boolean |
typeExists(String index,
String type)
check if type is exists in an index
|
org.elasticsearch.action.update.UpdateResponse |
update(UpdateQuery updateQuery)
Partial update of the document
|
ElasticsearchConverter getElasticsearchConverter()
org.elasticsearch.client.Client getClient()
<T> boolean createIndex(Class<T> clazz)
T
- clazz
- boolean createIndex(String indexName)
indexName
- boolean createIndex(String indexName, Object settings)
indexName
- settings
- <T> boolean createIndex(Class<T> clazz, Object settings)
clazz
- settings
- <T> boolean putMapping(Class<T> clazz)
T
- clazz
- boolean putMapping(String indexName, String type, Object mappings)
indexName
- type
- mappings
- <T> boolean putMapping(Class<T> clazz, Object mappings)
clazz
- mappings
- <T> Map getMapping(Class<T> clazz)
T
- clazz
- Map getMapping(String indexName, String type)
indexName
- type
- Map getSetting(String indexName)
indexName
- <T> T queryForObject(GetQuery query, Class<T> clazz)
query
- clazz
- <T> T queryForObject(GetQuery query, Class<T> clazz, GetResultMapper mapper)
query
- clazz
- mapper
- <T> T queryForObject(CriteriaQuery query, Class<T> clazz)
query
- clazz
- <T> T queryForObject(StringQuery query, Class<T> clazz)
query
- clazz
- <T> Page<T> queryForPage(SearchQuery query, Class<T> clazz)
Page
query
- clazz
- <T> Page<T> queryForPage(SearchQuery query, Class<T> clazz, SearchResultMapper mapper)
Page
using custom mapperquery
- clazz
- <T> Page<T> queryForPage(CriteriaQuery query, Class<T> clazz)
Page
query
- clazz
- <T> Page<T> queryForPage(StringQuery query, Class<T> clazz)
Page
query
- clazz
- <T> Page<T> queryForPage(StringQuery query, Class<T> clazz, SearchResultMapper mapper)
Page
using custom mapperquery
- clazz
- <T> CloseableIterator<T> stream(CriteriaQuery query, Class<T> clazz)
CriteriaQuery
against elasticsearch and return result as CloseableIterator
.
Returns a CloseableIterator
that wraps an Elasticsearch scroll context that needs to be closed in case of error.
T
- element return typequery
- clazz
- <T> CloseableIterator<T> stream(SearchQuery query, Class<T> clazz)
SearchQuery
against elasticsearch and return result as CloseableIterator
.
Returns a CloseableIterator
that wraps an Elasticsearch scroll context that needs to be closed in case of error.
T
- element return typequery
- clazz
- <T> CloseableIterator<T> stream(SearchQuery query, Class<T> clazz, SearchResultMapper mapper)
SearchQuery
against elasticsearch and return result as CloseableIterator
using custom mapper.
Returns a CloseableIterator
that wraps an Elasticsearch scroll context that needs to be closed in case of error.
T
- element return typequery
- clazz
- mapper
- <T> List<T> queryForList(CriteriaQuery query, Class<T> clazz)
List
T
- query
- clazz
- <T> List<T> queryForList(StringQuery query, Class<T> clazz)
List
T
- query
- clazz
- <T> List<T> queryForList(SearchQuery query, Class<T> clazz)
List
T
- query
- clazz
- <T> List<String> queryForIds(SearchQuery query)
query
- <T> long count(CriteriaQuery query, Class<T> clazz)
query
- clazz
- <T> long count(CriteriaQuery query)
query
- <T> long count(SearchQuery query, Class<T> clazz)
query
- clazz
- <T> long count(SearchQuery query)
query
- <T> LinkedList<T> multiGet(SearchQuery searchQuery, Class<T> clazz)
searchQuery
- clazz
- <T> LinkedList<T> multiGet(SearchQuery searchQuery, Class<T> clazz, MultiGetResultMapper multiGetResultMapper)
searchQuery
- clazz
- multiGetResultMapper
- String index(IndexQuery query)
query
- org.elasticsearch.action.update.UpdateResponse update(UpdateQuery updateQuery)
updateQuery
- void bulkIndex(List<IndexQuery> queries)
queries
- void bulkUpdate(List<UpdateQuery> queries)
queries
- String delete(String indexName, String type, String id)
indexName
- type
- id
- <T> void delete(CriteriaQuery criteriaQuery, Class<T> clazz)
clazz
- criteriaQuery
- <T> String delete(Class<T> clazz, String id)
clazz
- id
- <T> void delete(DeleteQuery query, Class<T> clazz)
clazz
- query
- void delete(DeleteQuery query)
query
- <T> boolean deleteIndex(Class<T> clazz)
T
- clazz
- boolean deleteIndex(String indexName)
indexName
- <T> boolean indexExists(Class<T> clazz)
T
- clazz
- boolean indexExists(String indexName)
indexName
- boolean typeExists(String index, String type)
index
- type
- void refresh(String indexName)
indexName
- <T> void refresh(Class<T> clazz)
clazz
- String scan(CriteriaQuery query, long scrollTimeInMillis, boolean noFields)
query
- The criteria query.scrollTimeInMillis
- The time in millisecond for scroll feature
SearchRequestBuilder.setScroll(org.elasticsearch.common.unit.TimeValue)
.noFields
- The no fields support
SearchRequestBuilder.setNoFields()
.<T> String scan(CriteriaQuery query, long scrollTimeInMillis, boolean noFields, Class<T> clazz)
T
- The type of entity to retrieve.query
- The criteria query.scrollTimeInMillis
- The time in millisecond for scroll feature
SearchRequestBuilder.setScroll(org.elasticsearch.common.unit.TimeValue)
.noFields
- The no fields support
SearchRequestBuilder.setNoFields()
.clazz
- The class of entity to retrieve.String scan(SearchQuery query, long scrollTimeInMillis, boolean noFields)
query
- The search query.scrollTimeInMillis
- The time in millisecond for scroll feature
SearchRequestBuilder.setScroll(org.elasticsearch.common.unit.TimeValue)
.noFields
- The no fields support
SearchRequestBuilder.setNoFields()
.<T> String scan(SearchQuery query, long scrollTimeInMillis, boolean noFields, Class<T> clazz)
T
- The type of entity to retrieve.query
- The search query.scrollTimeInMillis
- The time in millisecond for scroll feature
SearchRequestBuilder.setScroll(org.elasticsearch.common.unit.TimeValue)
.noFields
- The no fields support
SearchRequestBuilder.setNoFields()
.clazz
- The class of entity to retrieve.<T> Page<T> scroll(String scrollId, long scrollTimeInMillis, Class<T> clazz)
T
- scrollId
- scrollTimeInMillis
- clazz
- <T> Page<T> scroll(String scrollId, long scrollTimeInMillis, SearchResultMapper mapper)
T
- scrollId
- scrollTimeInMillis
- mapper
- <T> void clearScroll(String scrollId)
scrollId
- <T> Page<T> moreLikeThis(MoreLikeThisQuery query, Class<T> clazz)
T
- query
- clazz
- Boolean addAlias(AliasQuery query)
query
- Boolean removeAlias(AliasQuery query)
query
- List<org.elasticsearch.cluster.metadata.AliasMetaData> queryForAlias(String indexName)
indexName
- <T> T query(SearchQuery query, ResultsExtractor<T> resultsExtractor)
ElasticsearchPersistentEntity getPersistentEntityFor(Class clazz)
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.