@Configuration public class ElasticsearchConfigurationSupport extends Object
| Constructor and Description |
|---|
ElasticsearchConfigurationSupport() |
| Modifier and Type | Method and Description |
|---|---|
ElasticsearchConverter |
elasticsearchConverter() |
ElasticsearchCustomConversions |
elasticsearchCustomConversions()
Register custom
Converters in a ElasticsearchCustomConversions object if required. |
SimpleElasticsearchMappingContext |
elasticsearchMappingContext()
Creates a
SimpleElasticsearchMappingContext equipped with entity classes scanned from the mapping base
package. |
EntityMapper |
entityMapper()
Returns the
EntityMapper used for mapping between the source and domain type. |
protected Set<Class<?>> |
getInitialEntitySet()
Scans the mapping base package for classes annotated with
Document. |
protected Collection<String> |
getMappingBasePackages()
Returns the base packages to scan for Elasticsearch mapped entities at startup.
|
ResultsMapper |
resultsMapper()
Returns the
ResultsMapper to be used for search responses. |
protected Set<Class<?>> |
scanForEntities(String basePackage)
Scans the given base package for entities, i.e.
|
@Bean public ElasticsearchConverter elasticsearchConverter()
@Bean public SimpleElasticsearchMappingContext elasticsearchMappingContext()
SimpleElasticsearchMappingContext equipped with entity classes scanned from the mapping base
package.getMappingBasePackages()@Bean public EntityMapper entityMapper()
EntityMapper used for mapping between the source and domain type. ElasticsearchEntityMapper as
an alternative to the DefaultEntityMapper.
ElasticsearchEntityMapper entityMapper = new ElasticsearchEntityMapper(elasticsearchMappingContext(),
new DefaultConversionService());
entityMapper.setConversions(elasticsearchCustomConversions());
@Bean public ResultsMapper resultsMapper()
ResultsMapper to be used for search responses.entityMapper()@Bean public ElasticsearchCustomConversions elasticsearchCustomConversions()
Converters in a ElasticsearchCustomConversions object if required.protected Collection<String> getMappingBasePackages()
com.acme.AppConfig extending ElasticsearchConfigurationSupport the base package will be considered
com.acme unless the method is overridden to implement alternate behavior.Document classes or an empty collection to not enable scanning
for entities.protected Set<Class<?>> getInitialEntitySet() throws ClassNotFoundException
Document. By default, it scans for entities in
all packages returned by getMappingBasePackages().ClassNotFoundExceptiongetMappingBasePackages()protected Set<Class<?>> scanForEntities(String basePackage) throws ClassNotFoundException
Document and
Persistent.basePackage - must not be null.ClassNotFoundExceptionCopyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.