spring-data-elasticsearch

Spring Data api (Containing or startwith) not working with SPACE which has wildcard

我与影子孤独终老i 提交于 2019-12-10 20:40:16
问题 I am using Elastic Search with Spring Data . I have a simple method in repository: findByUserNameContaining("a b"); This method not giving expecting result because of SPACE. Error getting: "Cannot constructQuery ' "a b" '. Use expression or multiple clauses instead." EXCEPTION="org.springframework.dao.InvalidDataAccessApiUsageException: Cannot constructQuery ' "a b" '. Use expression or multiple clauses instead. For stopping creation of multiple tokens because of Space. I have mapping:

Spring data elastic search wild card search

梦想的初衷 提交于 2019-12-10 18:18:45
问题 I am trying to search for the word blue in the below list of text "BlueSaphire","Bluo","alue","blue", "BLUE", "Blue","Blue Black","Bluo","Saphire Blue", "black" , "green","bloo" , "Saphireblue" SearchQuery searchQuery = new NativeSearchQueryBuilder().withIndices("color") .withQuery(matchQuery("colorDescriptionCode", "blue") .fuzziness(Fuzziness.ONE) ) .build(); This works fine and the search result returns the below records along with the scores alue 2.8718023 Bluo 1.7804208 Bluo 1.7804208

How to set result size zero in spring data elasticsearch

北慕城南 提交于 2019-12-10 15:45:52
问题 Consider the following elasticsearch query : { "query": {"match_all": {}}, "size": 0, "aggs": { "Terms": { "terms": { "field":"fileName" } } } } Here I'm just interested in the aggregation and not in the documents. That's why I set size:0 and it works as expected. However I'm unable to achieve the same with spring-data . Code sample : PageRequest page = new PageRequest(0, 0); SearchQuery searchQuery = new NativeSearchQueryBuilder() .withIndices(indexName).withTypes(typeName) .withQuery

How to interact with elastic search Alias using Spring data

假装没事ソ 提交于 2019-12-10 13:33:43
问题 Hi I am using elastic search Spring data. Domain structure of my project keeps on changing.So I have to drop the index in order to change the mapping every time. To overcome this problem, I am using Aliases. I created an Alias using: elasticsearchTemplate.createIndex(Test.class); elasticsearchTemplate.putMapping(Test.class); String aliasName = "test-alias"; AliasQuery aliasQuery = new AliasBuilder() .withIndexName("test") .withAliasName(aliasName).build(); elasticsearchTemplate.addAlias

How to configure Spring Boot with elasticsearch 5.2.1?

浪子不回头ぞ 提交于 2019-12-10 13:00:56
问题 I am trying to connect my Spring Boot application to local elasticsearch 5.2.1 instance. When i use " org.springframework.boot:spring-boot-starter-data-elasticsearch " dependency, i face with " Received message from unsupported version: [2.0.0] minimal compatible version is: [5.0.0] ". I think this is due to elasticsearch version is 2.4.4 in starter dependency. So to solve this error, i edit pom.xml properties by adding elasticsearch.version>5.2.1/elasticsearch.version> line. But this time i

ElasticSearch installation error - curl: (7) Failed connect to localhost:9200; Connection refused

邮差的信 提交于 2019-12-10 09:29:24
问题 I'm trying to configure ElasticSearch with this tutorial I did everything except step 4 of the tutorial. In step 5, when I run this command: curl -X GET 'http://localhost:9200' I get this error: curl: (7) Failed connect to localhost:9200; Connection refused I have tried two different things to fix the error: network.bind_host: 0.0.0.0 network : host : 192.168.2.229 But neither solved the problem. What should I do to test Elasticsearch and solve this error? Thanks. 回答1: You just have to

Spring Elastic Search Custom Field names

三世轮回 提交于 2019-12-10 02:45:06
问题 I am new to Elastic Search and I am trying to implement it using Spring-data-elasticsearch. I have fields with names such as "Transportation", "Telephone_Number" in our elastic search documents. When I try to map my @Domain object fields with those, I don't get any data for those as I couldn't successfully map those fields. Tried to use @Field, was disappointed as it didn't have 'name' property in it to map with custom field name. Tried different variations of a GETTER function, none of those

elastic search 5.5 highlight field is not working

 ̄綄美尐妖づ 提交于 2019-12-09 21:12:51
问题 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(

None of the configured nodes are available issue with spring boot

≯℡__Kan透↙ 提交于 2019-12-09 17:08:45
问题 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:

Spring data ElastiSearch aggregations with filters

拜拜、爱过 提交于 2019-12-09 00:22:55
问题 I am trying to perform aggregations on values filtered by some conditions. I am using ElasticSearchTemplate.query() method of spring data too execute query and get the results in result extractor. I am getting the hits correctly (i.e. filters are applied and docs matching those values are only retrieved.). However, aggregations are performed on all the docs. I believe aggregations should be applied to filtered values only. Following is the code I am using: SearchQuery query = //get the query