Skip to content

Commit

Permalink
Fjernet parameterisert indeksnavn #deploy-test-dolly-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
krharum committed Nov 14, 2023
1 parent bd99c24 commit e3a97c9
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

import static java.util.Objects.isNull;

@Document(indexName = "${opensearch.index-name}")
@Document(indexName = "bestilling")
@Data
@Builder
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ElasticBestilling> 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) {
Expand Down Expand Up @@ -103,6 +101,6 @@ private SearchHits<ElasticBestilling> 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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public class OpensearchImport implements ApplicationListener<ContextRefreshedEve
private final MapperFacade mapperFacade;
private final RestHighLevelClient restHighLevelClient;

@Value("${opensearch.index-name}")
private String index;

@Value("${opensearch.total-fields}")
private String totalFields;

Expand All @@ -57,7 +54,7 @@ public void onApplicationEvent(ContextRefreshedEvent event) {
.putSettings(request, RequestOptions.DEFAULT);

} catch (OpenSearchException | IOException e) {
log.error("Feilet å sette {} for index {}", TOTAL_FIELDS, index, e);
log.error("Feilet å sette {} for samtlige indekser", TOTAL_FIELDS, e);
}

var start = System.currentTimeMillis();
Expand Down
3 changes: 0 additions & 3 deletions apps/dolly-backend/src/main/resources/application-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ consumers:
testnav-organisasjon-tilgang-service:
cluster: dev-gcp
url: http://testnav-organisasjon-tilgang-service.dolly.svc.cluster.local

opensearch:
index-name: bestillinger-dev
1 change: 0 additions & 1 deletion apps/dolly-backend/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ logging:
jdbc: ERROR

opensearch:
index-name: bestillinger
total-fields: 1500

consumers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import no.nav.testnav.libs.data.pdlforvalter.v1.Identtype;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -46,7 +45,6 @@
@ActiveProfiles({"test", "integrationtest"})
@ExtendWith(SpringExtension.class)
@AutoConfigureMockMvc(addFilters = false)
@Disabled
@SpringBootTest(webEnvironment = RANDOM_PORT)
class ElasticControllerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ azure:
secret: dummy

opensearch:
index-name: bestillinger
total-fields: 150

consumers:
Expand Down

0 comments on commit e3a97c9

Please sign in to comment.