Go to file
2024-09-25 11:28:47 +00:00
.github OPS-382:Change elastic to opensearch, add shop and wallets search (#32) 2023-11-27 13:09:46 +03:00
src remove payout + bump damsel (#63) 2024-09-25 14:28:23 +03:00
.gitignore init 2020-07-08 12:45:33 +03:00
CODEOWNERS 🔄 Created local 'CODEOWNERS' from remote 'codeowners/java' 2022-03-30 01:12:21 +00:00
LICENSE Let's make it opensource 2021-08-03 13:28:06 +03:00
pom.xml Update dependency dev.vality:service-parent-pom to v2.2.0 2024-09-25 11:28:47 +00:00
README.md OPS-407: refactor search query, use keywords (#49) 2024-02-12 12:41:33 +02:00
renovate.json Add renovate.json 2022-03-16 08:11:55 +00:00

deanonimus

Сервис для полнотекстового поиска party

актуальные примеры с spring data elastic + opensearch

https://github.com/opensearch-project/spring-data-opensearch/blob/main/spring-data-opensearch-examples/spring-boot-gradle/src/main/java/org/opensearch/data/example/service/MarketplaceInitializer.java
https://github.com/M-Razavi/Spring-Data-OpenSearch-Example

полезные ссылки
https://opensearch.org/docs/latest/query-dsl/full-text/index/
https://opensearch.org/docs/latest/query-dsl/full-text/multi-match/

сниппеты

getMappingResponse.get("party").mappings().properties().get("id").text().fields().get("keyword").keyword()

search.hits().hits().get(0).source()

var criteria = QueryBuilders.boolQuery()
        .must(QueryBuilders.matchQuery("authorName", author))
        .must(QueryBuilders.matchQuery("title", title));

SearchRequest searchRequest = new SearchRequest("books");
        searchRequest.source().query(criteria);

        try {
SearchResponse response = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
            return Arrays.stream(response.getHits().getHits())
        .map(hit -> new ObjectMapper().convertValue(hit.getSourceAsMap(), Book.class))
        .collect(Collectors.toList());
        } catch (IOException e) {
        throw new RuntimeException("Error executing search", e);
        }