diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java index 9fce109b161..d51132dac6e 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java @@ -43,7 +43,7 @@ import static java.util.Objects.isNull; -@Document(indexName = "${opensearch.index-name}") +@Document(indexName = "bestilling") @Data @Builder @NoArgsConstructor diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/SearchHelperService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/SearchHelperService.java index 51c140e67c3..3fc6095f246 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/SearchHelperService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/service/SearchHelperService.java @@ -4,7 +4,6 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.elastic.ElasticBestilling; import no.nav.dolly.elastic.dto.SearchResponse; -import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.core.ElasticsearchOperations; import org.springframework.data.elasticsearch.core.SearchHit; @@ -29,21 +28,20 @@ @RequiredArgsConstructor public class SearchHelperService { + private static String INDEX_NAME = "bestilling"; + private static final int WINDOW_SIZE = 10; private static final double FACTOR = 2; private final ElasticsearchOperations elasticsearchOperations; private Random random = new SecureRandom(); - @Value("${opensearch.index-name}") - private String indexName; - public SearchHits getRaw(Criteria criteria) { return elasticsearchOperations.search(new CriteriaQueryBuilder(criteria) .withTimeout(Duration.ofSeconds(3)) .build(), - ElasticBestilling.class, IndexCoordinates.of(indexName)); + ElasticBestilling.class, IndexCoordinates.of(INDEX_NAME)); } public SearchResponse search(Criteria criteria) { @@ -103,6 +101,6 @@ private SearchHits search(Criteria criteria, int pageSize, in .withPageable(Pageable.ofSize(pageSize).withPage(pageNo)) .withTimeout(Duration.ofSeconds(3)) .build(), - ElasticBestilling.class, IndexCoordinates.of(indexName)); + ElasticBestilling.class, IndexCoordinates.of(INDEX_NAME)); } } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/utils/OpensearchImport.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/utils/OpensearchImport.java index ae15583c3db..c89f9fcab7c 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/utils/OpensearchImport.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/utils/OpensearchImport.java @@ -38,9 +38,6 @@ public class OpensearchImport implements ApplicationListener