Spring Data Elasticsearch

org.springframework.data.elasticsearch.repository.support
Class SimpleElasticsearchRepository<T>

java.lang.Object
  extended by org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository<T>
Type Parameters:
T -
All Implemented Interfaces:
ElasticsearchCrudRepository<T,String>, ElasticsearchRepository<T,String>, org.springframework.data.repository.CrudRepository<T,String>, org.springframework.data.repository.PagingAndSortingRepository<T,String>, org.springframework.data.repository.Repository<T,String>

public class SimpleElasticsearchRepository<T>
extends Object
implements ElasticsearchRepository<T,String>

Elasticsearch specific repository implementation. Likely to be used as target within ElasticsearchRepositoryFactory


Constructor Summary
SimpleElasticsearchRepository()
           
SimpleElasticsearchRepository(ElasticsearchEntityInformation<T,String> metadata, ElasticsearchOperations elasticsearchOperations)
           
SimpleElasticsearchRepository(ElasticsearchOperations elasticsearchOperations)
           
 
Method Summary
 long count()
           
 void createIndex()
           
 void delete(Iterable<? extends T> entities)
           
 void delete(String id)
           
 void delete(T entity)
           
 void deleteAll()
           
 boolean exists(String id)
           
 Iterable<T> findAll()
           
 Iterable<T> findAll(Iterable<String> ids)
           
 org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
           
 Iterable<T> findAll(org.springframework.data.domain.Sort sort)
           
 T findOne(String id)
           
 Class<T> getEntityClass()
           
<S extends T>
S
index(S entity)
           
<S extends T>
Iterable<S>
save(Iterable<S> entities)
           
<S extends T>
List<S>
save(List<S> entities)
           
<S extends T>
S
save(S entity)
           
 Iterable<T> search(org.elasticsearch.index.query.QueryBuilder elasticsearchQuery)
           
 org.springframework.data.domain.Page<T> search(org.elasticsearch.index.query.QueryBuilder elasticsearchQuery, org.springframework.data.domain.Pageable pageable)
           
 org.springframework.data.domain.Page<T> search(SearchQuery query)
           
 void setElasticsearchOperations(ElasticsearchOperations elasticsearchOperations)
           
 void setEntityClass(Class<T> entityClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleElasticsearchRepository

public SimpleElasticsearchRepository()

SimpleElasticsearchRepository

public SimpleElasticsearchRepository(ElasticsearchOperations elasticsearchOperations)

SimpleElasticsearchRepository

public SimpleElasticsearchRepository(ElasticsearchEntityInformation<T,String> metadata,
                                     ElasticsearchOperations elasticsearchOperations)
Method Detail

createIndex

@PostConstruct
public void createIndex()

findOne

public T findOne(String id)
Specified by:
findOne in interface org.springframework.data.repository.CrudRepository<T,String>

findAll

public Iterable<T> findAll()
Specified by:
findAll in interface org.springframework.data.repository.CrudRepository<T,String>

findAll

public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
Specified by:
findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,String>

findAll

public Iterable<T> findAll(org.springframework.data.domain.Sort sort)
Specified by:
findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,String>

findAll

public Iterable<T> findAll(Iterable<String> ids)
Specified by:
findAll in interface org.springframework.data.repository.CrudRepository<T,String>

count

public long count()
Specified by:
count in interface org.springframework.data.repository.CrudRepository<T,String>

save

public <S extends T> S save(S entity)
Specified by:
save in interface org.springframework.data.repository.CrudRepository<T,String>

save

public <S extends T> List<S> save(List<S> entities)
Specified by:
save in interface ElasticsearchCrudRepository<T,String>

index

public <S extends T> S index(S entity)
Specified by:
index in interface ElasticsearchRepository<T,String>

save

public <S extends T> Iterable<S> save(Iterable<S> entities)
Specified by:
save in interface org.springframework.data.repository.CrudRepository<T,String>

exists

public boolean exists(String id)
Specified by:
exists in interface org.springframework.data.repository.CrudRepository<T,String>

search

public Iterable<T> search(org.elasticsearch.index.query.QueryBuilder elasticsearchQuery)
Specified by:
search in interface ElasticsearchRepository<T,String>

search

public org.springframework.data.domain.Page<T> search(org.elasticsearch.index.query.QueryBuilder elasticsearchQuery,
                                                      org.springframework.data.domain.Pageable pageable)
Specified by:
search in interface ElasticsearchRepository<T,String>

search

public org.springframework.data.domain.Page<T> search(SearchQuery query)
Specified by:
search in interface ElasticsearchRepository<T,String>

delete

public void delete(String id)
Specified by:
delete in interface org.springframework.data.repository.CrudRepository<T,String>

delete

public void delete(T entity)
Specified by:
delete in interface org.springframework.data.repository.CrudRepository<T,String>

delete

public void delete(Iterable<? extends T> entities)
Specified by:
delete in interface org.springframework.data.repository.CrudRepository<T,String>

deleteAll

public void deleteAll()
Specified by:
deleteAll in interface org.springframework.data.repository.CrudRepository<T,String>

getEntityClass

public Class<T> getEntityClass()

setEntityClass

public final void setEntityClass(Class<T> entityClass)

setElasticsearchOperations

public final void setElasticsearchOperations(ElasticsearchOperations elasticsearchOperations)

Spring Data Elasticsearch

Copyright © 2013 BioMed Central. All Rights Reserved.