spring-data-elasticsearch

elastic search 5.5 highlight field is not working

心不动则不痛 提交于 2019-12-04 17:02:05
I have tested the elastic search highlight field function and it was working fine . I used elastic search 2.4.4 and spring-data-elasticsearch-2.0.0.RELEASE The sample code is in the below post How to provide highlighting with Spring data elasticsearch I have recently upgraded to elastic search to 5.5.0 and spring-data-elasticsearch-3.0.0.M4 when I test the same code , highlight does not happen Below is the sample code SearchQuery searchQuery = new NativeSearchQueryBuilder().withIndices("occindex") .withPageable(new PageRequest(0, mySpecification.getNoOfRecords())) .withQuery(QueryBuilders

How can i use a annotation to do an aggragation like @Query(value = “{”query“:”“}”)

本小妞迷上赌 提交于 2019-12-04 05:29:15
问题 How can I use an annotation to do an aggragation like @Query(value = "{"query":""}") with spring-data-elasticsearch? 回答1: You cannot do it with the @Query annotation whose only purpose is to send a query, not aggregations. The only way to achieve this with Spring Data Elasticsearch is to leverage NativeSearchQueryBuilder and ElasticsearchTemplate : SearchQuery searchQuery = new NativeSearchQueryBuilder() .withQuery(QueryBuilders.matchAll()) .withSearchType(COUNT) .withIndices("your_index")

None of the configured nodes are available issue with spring boot

邮差的信 提交于 2019-12-04 04:53:22
Hi friends i am developing spring boot project with elastic search i have setup elastic search on local machine and i have installed Head plugin in elastic search . My elastic search is setup correctly showing green sign. My application-dev.yml file in my project is as follows: server: port: 8080 liquibase: context: dev spring: profiles: active: dev datasource: dataSourceClassName: org.h2.jdbcx.JdbcDataSource url: jdbc:h2:mem:jhipster;DB_CLOSE_DELAY=-1 databaseName: serverName: username: password: jpa: database-platform: com.aquevix.demo.domain.util.FixedH2Dialect database: H2 openInView:

Caused by: java.lang.ClassNotFoundException: org.elasticsearch.transport.Netty3Plugin

元气小坏坏 提交于 2019-12-04 03:31:14
问题 I'm using Spring Boot 2.0.3 Release and i have problem while instantiating org.elasticsearch.client.Client . My code: Client client = new PreBuiltTransportClient(Settings.builder() .put("cluster.name", clustername) .build()) .addTransportAddress( new InetSocketTransportAddress(InetAddress.getByName(host), port) ); This code give me the error: Caused by: java.lang.NoClassDefFoundError: org/elasticsearch/transport/Netty3Plugin at org.elasticsearch.transport.client.PreBuiltTransportClient.

How to make elasticsearch embedded accessible via localhost:9200

半世苍凉 提交于 2019-12-04 03:19:16
I am playing with spring-boot-sample-data-elastcisearch project. I've changed the pom and added: SampleElasticsearchApplicationWebXml extends SpringBootServletInitializer to run with Tomcat embedded. My application.properties has spring.data.elasticsearch.http-enabled=true spring.data.elasticsearch.local=true I want to be able to connect to localhost:9200 in order to use elasticsearch-head or other JS client. What am I missing? Thanks, Milan you should define this for yourself, because NodeClientFactoryBean has an option for http.enabled but ElasticSearchAutoConfiguration does not (yet) set it

Spring Data Elasticsearch's @Field annotation not working

本小妞迷上赌 提交于 2019-12-04 00:15:33
I have a Spring Boot application with Spring Data Elasticsearch plugin in the pom.xml. I created a document class which i'd like to index: @Document(indexName = "operations", type = "operation") public class OperationDocument { @Id private Long id; @Field( type = FieldType.String, index = FieldIndex.analyzed, searchAnalyzer = "standard", indexAnalyzer = "standard", store = true ) private String operationName; @Field( type = FieldType.Date, index = FieldIndex.not_analyzed, store = true, format = DateFormat.custom, pattern = "dd.MM.yyyy hh:mm" ) private Date dateUp; @Field( type = FieldType

spring-data-elasticsearch searching over multiple indices

谁说胖子不能爱 提交于 2019-12-03 08:52:25
i have a searchfield on my page and this searchfield should search over more than one indice. I can search for one indice without a problem, like described in the documentation of spring-data-elasticsearch. But if i search, as example for "Foo", i want to have the following list as result ordered by relevance: { title: "Foo" } -> Entity: Sample { name: "FooTest" } -> Entity: Test { title: "FooSample2" } -> Entity: Sample // ...and so on // The entities are not part of the same parent. So, they are complete different. For this i couldn't find anything in documentation that would help me. can

Spring-Data-Elasticsearch settings: Spring can't find config file?

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: With Spring-Data-Elasticsearch, I am trying to use analyzers and mappings defined in elasticsearch_config.json . This JSON file is in /src/main/resources folder. My JAVA model looks like: @Document ( indexName = "test" , type = "Tweet" ) @Setting ( settingPath = "/elasticsearch_config.json" ) public class Tweet { @Id private String idStr ; /** other fields, getters and setters are omitted **/ } elasticsearch_config.json contains both settings and mappings: { "settings" : { /* some filters */ }, "mappings" : { /* some types'

ElasticSearch : Can we apply both n-gram and language analyzers during indexing

霸气de小男生 提交于 2019-12-02 06:51:35
Thanks a lot @Random , I have modified the mapping as follows. For testing I have used "movie" as my type for indexing. Note: I have added search_analyzer also. I was not getting proper results without that. However I have following doubts for using search_analyzer. 1] Can we use custom search_analyzer in case of language analyzers ? 2] am I getting all the results due to n-gram analyzer I have used and not due to english analyzer? { "settings": { "analysis": { "analyzer": { "english_ngram": { "type": "custom", "filter": [ "english_possessive_stemmer", "lowercase", "english_stop", "english

Compatible versions of Spring boot,elasticsearch and spring data elasticsearch

此生再无相见时 提交于 2019-12-01 20:35:59
I have been developing a simple java programming using spring boot,elastic search and spring data elastic search. I am able to do the elastic search successfully with below versions 1) spring boot 1.3.5 2) spring-data-elasticsearch 1.3.4.RELEASE 3) elasticsearch 1.3.2 but when i upgraded to the below versions,one of my service class annotated with @service annotation showing error as "The type org.elasticsearch.search.suggest.SuggestBuilder$SuggestionBuilder cannot be resolved. It is indirectly referenced from required .class files". 1) spring boot 1.5.1.RELEASE 2) spring-data-elasticsearch 2