Spring Data Elasticsearch

org.springframework.data.elasticsearch.core
Interface ElasticsearchOperations

All Known Implementing Classes:
ElasticsearchTemplate

public interface ElasticsearchOperations


Method Summary
 void bulkIndex(List<IndexQuery> queries)
          Bulk index all objects.
<T> long
count(SearchQuery query, Class<T> clazz)
          return number of elements found by for given query
<T> boolean
createIndex(Class<T> clazz)
          Create an index
<T> String
delete(Class<T> clazz, String id)
          Delete the one object with provided id
<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
 ElasticsearchConverter getElasticsearchConverter()
           
 String index(IndexQuery query)
          Index an object.
<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(StringQuery query, Class<T> clazz)
          Execute the query against elasticsearch and return the first returned object
<T> org.springframework.data.domain.Page<T>
queryForPage(CriteriaQuery query, Class<T> clazz)
          Execute the query against elasticsearch and return result as Page
<T> org.springframework.data.domain.Page<T>
queryForPage(SearchQuery query, Class<T> clazz)
          Execute the query against elasticsearch and return result as Page
<T> org.springframework.data.domain.Page<T>
queryForPage(StringQuery query, Class<T> clazz)
          Execute the query against elasticsearch and return result as Page
<T> void
refresh(Class<T> clazz, boolean waitForOperation)
          refresh the index
 void refresh(String indexName, boolean waitForOperation)
          refresh the index
 

Method Detail

getElasticsearchConverter

ElasticsearchConverter getElasticsearchConverter()
Returns:
Converter in use

createIndex

<T> boolean createIndex(Class<T> clazz)
Create an index

Type Parameters:
T -
Parameters:
clazz -

queryForObject

<T> T queryForObject(GetQuery query,
                     Class<T> clazz)
Execute the query against elasticsearch and return the first returned object

Parameters:
query -
clazz -
Returns:
the first matching object

queryForObject

<T> T queryForObject(CriteriaQuery query,
                     Class<T> clazz)
Execute the query against elasticsearch and return the first returned object

Parameters:
query -
clazz -
Returns:
the first matching object

queryForObject

<T> T queryForObject(StringQuery query,
                     Class<T> clazz)
Execute the query against elasticsearch and return the first returned object

Parameters:
query -
clazz -
Returns:
the first matching object

queryForPage

<T> org.springframework.data.domain.Page<T> queryForPage(SearchQuery query,
                                                         Class<T> clazz)
Execute the query against elasticsearch and return result as Page

Parameters:
query -
clazz -
Returns:

queryForPage

<T> org.springframework.data.domain.Page<T> queryForPage(CriteriaQuery query,
                                                         Class<T> clazz)
Execute the query against elasticsearch and return result as Page

Parameters:
query -
clazz -
Returns:

queryForPage

<T> org.springframework.data.domain.Page<T> queryForPage(StringQuery query,
                                                         Class<T> clazz)
Execute the query against elasticsearch and return result as Page

Parameters:
query -
clazz -
Returns:

count

<T> long count(SearchQuery query,
               Class<T> clazz)
return number of elements found by for given query

Parameters:
query -
clazz -
Returns:

index

String index(IndexQuery query)
Index an object. Will do save or update

Parameters:
query -
Returns:
returns the document id

bulkIndex

void bulkIndex(List<IndexQuery> queries)
Bulk index all objects. Will do save or update

Parameters:
queries -

delete

String delete(String indexName,
              String type,
              String id)
Delete the one object with provided id

Parameters:
indexName -
type -
id -
Returns:
documentId of the document deleted

delete

<T> String delete(Class<T> clazz,
                  String id)
Delete the one object with provided id

Parameters:
clazz -
id -
Returns:
documentId of the document deleted

delete

<T> void delete(DeleteQuery query,
                Class<T> clazz)
Delete all records matching the query

Parameters:
clazz -
query -

refresh

void refresh(String indexName,
             boolean waitForOperation)
refresh the index

Parameters:
indexName -
waitForOperation -

refresh

<T> void refresh(Class<T> clazz,
                 boolean waitForOperation)
refresh the index

Parameters:
clazz -
waitForOperation -

Spring Data Elasticsearch

Copyright © 2013 BioMed Central. All Rights Reserved.