org.springframework.data.elasticsearch.core.ElasticsearchOperations Java Examples

The following examples show how to use org.springframework.data.elasticsearch.core.ElasticsearchOperations. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ElasticsearchConfiguration.java    From okta-jhipster-microservices-oauth-example with Apache License 2.0 5 votes vote down vote up
@Bean
@Primary
public ElasticsearchOperations elasticsearchTemplate(final JestClient jestClient,
                                                     final ElasticsearchConverter elasticsearchConverter,
                                                     final SimpleElasticsearchMappingContext simpleElasticsearchMappingContext,
                                                     EntityMapper mapper) {
    return new JestElasticsearchTemplate(
        jestClient,
        elasticsearchConverter,
        new DefaultJestResultsMapper(simpleElasticsearchMappingContext, mapper));
}
 
Example #2
Source File: ElasticsearchConfiguration.java    From okta-jhipster-microservices-oauth-example with Apache License 2.0 5 votes vote down vote up
@Bean
@Primary
public ElasticsearchOperations elasticsearchTemplate(final JestClient jestClient,
                                                     final ElasticsearchConverter elasticsearchConverter,
                                                     final SimpleElasticsearchMappingContext simpleElasticsearchMappingContext,
                                                     EntityMapper mapper) {
    return new JestElasticsearchTemplate(
        jestClient,
        elasticsearchConverter,
        new DefaultJestResultsMapper(simpleElasticsearchMappingContext, mapper));
}
 
Example #3
Source File: ElasticsearchConfiguration.java    From okta-jhipster-microservices-oauth-example with Apache License 2.0 5 votes vote down vote up
@Bean
@Primary
public ElasticsearchOperations elasticsearchTemplate(final JestClient jestClient,
                                                     final ElasticsearchConverter elasticsearchConverter,
                                                     final SimpleElasticsearchMappingContext simpleElasticsearchMappingContext,
                                                     EntityMapper mapper) {
    return new JestElasticsearchTemplate(
        jestClient,
        elasticsearchConverter,
        new DefaultJestResultsMapper(simpleElasticsearchMappingContext, mapper));
}
 
Example #4
Source File: ElasticsearchConfiguration.java    From 21-points with Apache License 2.0 5 votes vote down vote up
@Bean
@Primary
public ElasticsearchOperations elasticsearchTemplate(final JestClient jestClient,
                                                     final ElasticsearchConverter elasticsearchConverter,
                                                     final SimpleElasticsearchMappingContext simpleElasticsearchMappingContext,
                                                     EntityMapper mapper) {
    return new JestElasticsearchTemplate(
        jestClient,
        elasticsearchConverter,
        new DefaultJestResultsMapper(simpleElasticsearchMappingContext, mapper));
}
 
Example #5
Source File: PostRepositoryTest.java    From spring4-sandbox with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	ctx = new AnnotationConfigApplicationContext(ElasticSearchConfig.class);

	elasticsearchOperations = ctx.getBean(ElasticsearchOperations.class);
	posts = ctx.getBean(PostRepository.class);

}
 
Example #6
Source File: EsConfig.java    From pivotal-bank-demo with Apache License 2.0 4 votes vote down vote up
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws Exception {
    return new ElasticsearchTemplate(client());
}
 
Example #7
Source File: EsConfig.java    From pivotal-bank-demo with Apache License 2.0 4 votes vote down vote up
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws Exception {
    return new ElasticsearchTemplate(client());
}
 
Example #8
Source File: ESConfig.java    From albert with MIT License 4 votes vote down vote up
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws Exception {
	return new ElasticsearchTemplate(client());
}
 
Example #9
Source File: AclElasticsearchRepositoryFactoryBean.java    From strategy-spring-security-acl with Apache License 2.0 4 votes vote down vote up
public void setElasticsearchOperations(ElasticsearchOperations operations) {
  super.setElasticsearchOperations(operations);
  this.operations = operations;
}
 
Example #10
Source File: AclElasticsearchRepositoryFactoryBean.java    From strategy-spring-security-acl with Apache License 2.0 4 votes vote down vote up
public Factory(ElasticsearchOperations elasticsearchOperations) {
  super(elasticsearchOperations);
  this.elasticsearchOperations = elasticsearchOperations;
}
 
Example #11
Source File: AclElasticsearchRepository.java    From strategy-spring-security-acl with Apache License 2.0 4 votes vote down vote up
public AclElasticsearchRepository(ElasticsearchEntityInformation<T, ID> metadata,
    ElasticsearchOperations elasticsearchOperations, AclFilterProvider filterProvider) {
  super(metadata, elasticsearchOperations);
  this.filterProvider = filterProvider;
}
 
Example #12
Source File: AclElasticsearchRepository.java    From strategy-spring-security-acl with Apache License 2.0 4 votes vote down vote up
public AclElasticsearchRepository(ElasticsearchOperations elasticsearchOperations,
    AclFilterProvider filterProvider) {
  super(elasticsearchOperations);
  this.filterProvider = filterProvider;
}
 
Example #13
Source File: SpringElasticsearchOperationsBeanPostProcessor.java    From javamelody with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) {
	if (ELASTICSEARCH_OPERATIONS_AVAILABLE && bean instanceof ElasticsearchOperations) {
		final ElasticsearchOperations elasticsearchOperations = (ElasticsearchOperations) bean;
		if (DISABLED) {
			return elasticsearchOperations;
		}
		SERVICES_COUNTER.setDisplayed(!COUNTER_HIDDEN);
		SERVICES_COUNTER.setUsed(true);

		final InvocationHandler invocationHandler = new InvocationHandler() {
			/** {@inheritDoc} */
			@Override
			public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
				final StringBuilder requestName = new StringBuilder();
				requestName.append("elasticsearch.").append(method.getName()).append('(');
				if (args != null) {
					boolean first = true;
					for (final Object arg : args) {
						if (first) {
							first = false;
						} else {
							requestName.append(", ");
						}
						if (arg == null) {
							requestName.append("null");
						} else if (arg instanceof Class) {
							requestName.append(((Class<?>) arg).getSimpleName());
						} else {
							requestName.append(arg.getClass().getSimpleName());
						}
					}
				}
				requestName.append(')');
				return doInvoke(elasticsearchOperations, method, args, requestName.toString());
			}
		};
		final ElasticsearchOperations ops = JdbcWrapper.createProxy(elasticsearchOperations,
				invocationHandler);
		LOG.debug("elasticsearch operations monitoring initialized");
		return ops;
	}

	return bean;
}
 
Example #14
Source File: Config.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public ElasticsearchOperations elasticsearchTemplate() {
    return new ElasticsearchRestTemplate(client());
}
 
Example #15
Source File: ElasticSearchConfig.java    From spring4-sandbox with Apache License 2.0 4 votes vote down vote up
@Bean
public ElasticsearchOperations elasticsearchTemplate() {
	return new ElasticsearchTemplate(NodeBuilder.nodeBuilder().local(true).node().client());
}
 
Example #16
Source File: ElasticSearchConfig.java    From spring4-sandbox with Apache License 2.0 4 votes vote down vote up
@Bean
  public ElasticsearchOperations elasticsearchTemplate() {
return new ElasticsearchTemplate(NodeBuilder.nodeBuilder().local(true).node()
		.client());
  }