The Best way to use ElasticSearch in Spring java framework

前端 未结 4 1784
梦谈多话
梦谈多话 2021-01-31 04:24

I\'m developing a system which is planning to use elasticsearch as an data repository. I\'m trying to choose the best way to develop my application that can index and query data

4条回答
  •  星月不相逢
    2021-01-31 05:05

    Also for like queries in Elasticsearch using Spring Boot you can make something like this:

    Car car = new Car();
    car.setName(new InnerField("name", "имя"));
    
    QueryBuilder builder = QueryBuilders
                .boolQuery()
                .should(QueryBuilders.regexpQuery("name.ru", ".*" + name + ".*"))
                .should(QueryBuilders.regexpQuery("name.kk", ".*" + name + ".*"))
                .should(QueryBuilders.regexpQuery("name.qq", ".*" + name + ".*"));
    
    NativeSearchQuery build = new NativeSearchQueryBuilder().withQuery(builder).build();
    
        elasticsearchOperations.queryForList(build, tClass);
    

提交回复
热议问题