spring-data-elasticsearch

Elasticsearch 5.x Repository Java Spring Boot

孤人 提交于 2019-12-11 15:26:05
问题 I want to use the elasticsearchrepository with Java Spring Boot: https://github.com/spring-projects/spring-data-elasticsearch It is not a RELEASE version, but should work for elasticsearch 5.4.0. I'm using ELK stack 5.x. I have the following pom.xml dependencies: <repositories> <repository> <id>elasticsearch-releases</id> <url>https://artifacts.elastic.co/maven</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <dependency>

How to correctly address “can't add a _parent field that points to an already existing type, that isn't already a parent” on app startup

给你一囗甜甜゛ 提交于 2019-12-11 15:25:50
问题 I'm running into a problem with my Elasticsearch Document index creation failing on startup with "java.lang.IllegalArgumentException: can't add a _parent field that points to an already existing type, that isn't already a parent". I'm not sure if this is due to a version upgrade or b/c I am starting with a brand new Elasticsearch server install. Contrived example that shows what I'm seeing: // UserSearchResult.java @Document(indexName = "hr_index", type = "user") public class UserSearchResult

Ignore spaces in Elasticsearch

﹥>﹥吖頭↗ 提交于 2019-12-11 15:16:50
问题 For my search I want to take into account the fact that the "space" character is not mandatory in a filter request. For exemple: when I filter on "THE ONE" I see the corresponding document. I want to see it even if I write "THEONE" . This is how my query is built today: boolQueryBuilder.must(QueryBuilders.boolQuery() .should(QueryBuilders.wildcardQuery("description", "*" + searchedWord.toLowerCase() + "*")) .should(QueryBuilders.wildcardQuery("id", "*" + searchedWord.toUpperCase() + "*"))

Batch indexing Spring Data JPA entries to Elastic through Spring Data ElasticSearch

冷暖自知 提交于 2019-12-11 13:54:19
问题 Our current setup is MySQL as main data source through Spring Data JPA, with Hibernate Search to index and search data. We now decided to go to Elastic Search for searching to better align with other features, besides we need to have multiple servers sharing the indexing and searching. I'm able to setup Elastic using Spring Data ElasticSearch for data indexing and searching easily, through ElasticsearchRepository . But the challenge now is how to index all the existing MySQL records into

Spring Data java.lang.NoSuchMethodError

佐手、 提交于 2019-12-11 13:19:26
问题 Spring is throwing java.lang.NoSuchMethodError: org.springframework.data.util.ClassTypeInformation.from(Ljava/lang/Class;)Lorg/springframework/data/util/ClassTypeInformation; at org.springframework.data.elasticsearch.core.MappingBuilder.isEntity(MappingBuilder.java:260) at org.springframework.data.elasticsearch.core.MappingBuilder.mapEntity(MappingBuilder.java:97) at org.springframework.data.elasticsearch.core.MappingBuilder.buildMapping(MappingBuilder.java:70) at org.springframework.data

Spring data elasticsearch CRUD configuration

雨燕双飞 提交于 2019-12-11 08:32:43
问题 I am facing problem while configuring the spring data elasticsearch, I followed the procedure mentioned here Spring bean configuration for Crud Repositories. But I am getting error: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerRepo': Cannot resolve

matchAllQuery() in ElasticSearch

只愿长相守 提交于 2019-12-11 06:59:36
问题 matchAllQuery() in Elasticsearch gets me only 10 results how do I increase its output so that I can get as many results as per my requirement. Code QueryBuilder query = QueryBuilders.matchAllQuery(); 回答1: Yes u can do , here you can pass aPageRequestcount whatever you want and If you want no of records exist in Elastic search than repository.count() will work for that :- int aPageRequestcount = (int) repository.count(); NativeSearchQueryBuilder aNativeSearchQueryBuilder = new

How to configure elasticsearch 5

二次信任 提交于 2019-12-11 06:29:35
问题 How to configure elasticsearch 5 TransportClient. Now TransportClient is abstract class. I found only PreBuiltTransportClient, this is the new way to configure elasticsearch Client ? 回答1: Yes, you can find that in the official documentation for 5.0 as well Settings settings = Settings.builder() .put("cluster.name", "ElasticSearchClusterName"); TransportClient client = new PreBuiltTransportClient(settings) .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300

Spring Boot + Spring Data JPA + Spring Data ElasticSearch: elastic doesn't return any results

人走茶凉 提交于 2019-12-11 06:27:01
问题 I am new to setting up embedded Elasticsearch into my Spring Boot application where Spring Data JPA is setup with Postgres database. Now I've also added support for Elastic Search Spring Data repositories (or so I thought). The problem is that ES searches do not return anything (JSON array is empty), whilst JPA ones work correctly. I read that people need an index tool that runs every now and then, but I couldn't find anything related to this in the Spring Data Elastic Search documents. Do I

Get all documents from an index using spring-data-elasticsearch

让人想犯罪 __ 提交于 2019-12-10 21:11:46
问题 I am trying to connect to my external ElasticSearch server with Spring Boot. If I do a curl from command line, I get expected results. curl "http://ipAddr:9200/indexName/TYPE/_search?pretty=true" But getting this error when I try to access it via Spring Boot. <html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Mon Sep 11 12:39:15 IST 2017</div><div>There was an unexpected error (type