Skip to content

Adapt to elasticsearch client fix. #2306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ private SettingsParameter buildSettingsParameter(Class<?> clazz) {
settingsParameter.shards = 1;
settingsParameter.replicas = 1;
settingsParameter.refreshIntervall = "1s";
settingsParameter.indexStoreType = "fs";

if (settingAnnotation != null) {
processSettingAnnotation(settingAnnotation, settingsParameter);
Expand Down Expand Up @@ -516,7 +515,7 @@ Settings toSettings() {
index.append("refresh_interval", refreshIntervall);
}

if (indexStoreType != null) {
if (indexStoreType != null && !"fs".equals(indexStoreType)) {
index.append("store", new Settings().append("type", indexStoreType));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch._types.FieldValue;
import co.elastic.clients.elasticsearch._types.Script;
import co.elastic.clients.elasticsearch._types.mapping.RuntimeField;
import co.elastic.clients.elasticsearch._types.mapping.RuntimeFieldType;
import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
import co.elastic.clients.elasticsearch.cluster.HealthRequest;
import co.elastic.clients.elasticsearch.cluster.HealthResponse;
Expand All @@ -30,6 +27,8 @@
import co.elastic.clients.elasticsearch.core.SearchRequest;
import co.elastic.clients.elasticsearch.core.search.ResponseBody;
import co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient;
import co.elastic.clients.elasticsearch.indices.GetIndicesSettingsRequest;
import co.elastic.clients.elasticsearch.indices.GetIndicesSettingsResponse;
import co.elastic.clients.elasticsearch.indices.IndexSettings;
import co.elastic.clients.transport.ElasticsearchTransport;
import co.elastic.clients.transport.TransportOptions;
Expand Down Expand Up @@ -85,30 +84,12 @@ public class DevTests {
void someTest() throws IOException {

ElasticsearchClient client = imperativeElasticsearchClient;
ElasticsearchIndicesClient indicesClient = client.indices();

String index = "testindex";
indicesClient.create(b -> b.index("testindex"));

var p = new Product("p1", 42.0);

client.index(ir -> ir //
.index(index)//
.document(p));

client.indices().flush(f -> f.index(index));

RuntimeField runtimeField = RuntimeField.of(rf -> rf //
.type(RuntimeFieldType.Double) //
.script(Script.of(s -> s //
.inline(i -> i. //
source("emit(doc['price'].value * 1.19)") //
) //
)) //
); //

client.search(sr -> sr //
.index(index) //
.runtimeMappings("priceWithTax", runtimeField), //
Person.class); //
GetIndicesSettingsResponse getIndicesSettingsResponse = indicesClient
.getSettings(GetIndicesSettingsRequest.of(b -> b.index("testindex").includeDefaults(true)));
}

static class ReactiveClient {
Expand Down Expand Up @@ -371,7 +352,7 @@ private ResponseBody<EntityAsMap> searchReactive(SearchRequest searchRequest) {

private ClientConfiguration clientConfiguration() {
return ClientConfiguration.builder() //
.connectedTo("thranduil.local.:9200")//
.connectedTo("localhost:9200")//
.withBasicAuth("elastic", "hcraescitsale").withProxy("localhost:8080") //
.withHeaders(() -> {
HttpHeaders headers = new HttpHeaders();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ public void shouldSortResultsBySortOptions() {
e -> assertThat(e.getId()).isEqualTo("2"));
}

@Override
public boolean newElasticsearchClient() {
return true;
}

@Override
protected Query queryWithIds(String... ids) {
return ELCQueries.queryWithIds(ids);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
Expand All @@ -60,7 +59,6 @@
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.NewElasticsearchClientDevelopment;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
Expand Down Expand Up @@ -116,7 +114,7 @@
* @author Sijia Liu
*/
@SpringIntegrationTest
public abstract class ElasticsearchIntegrationTests implements NewElasticsearchClientDevelopment {
public abstract class ElasticsearchIntegrationTests {

static final Integer INDEX_MAX_RESULT_WINDOW = 10_000;

Expand Down Expand Up @@ -2782,7 +2780,6 @@ public void shouldNotIncludeDefaultsGetIndexSettings() {
assertThat(settings).doesNotContainKey("index.max_result_window");
}

@DisabledIf(value = "newElasticsearchClient", disabledReason = "todo #2165, ES issue 286")
@Test // DATAES-709
public void shouldIncludeDefaultsOnGetIndexSettings() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ IndexNameProvider indexNameProvider() {
}
}

@Override
public boolean newElasticsearchClient() {
return true;
}

@Override
protected Query getTermsAggsQuery(String aggsName, String aggsField) {
return ELCQueries.getTermsAggsQuery(aggsName, aggsField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
Expand All @@ -58,7 +57,6 @@
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.NewElasticsearchClientDevelopment;
import org.springframework.data.elasticsearch.RestStatusException;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
Expand Down Expand Up @@ -96,7 +94,7 @@
*/
@SuppressWarnings("SpringJavaAutowiredMembersInspection")
@SpringIntegrationTest
public abstract class ReactiveElasticsearchIntegrationTests implements NewElasticsearchClientDevelopment {
public abstract class ReactiveElasticsearchIntegrationTests {

@Autowired private ReactiveElasticsearchOperations operations;
@Autowired private IndexNameProvider indexNameProvider;
Expand Down Expand Up @@ -1065,7 +1063,6 @@ void shouldReturnExplanationWhenRequested() {
}).verifyComplete();
}

@DisabledIf(value = "newElasticsearchClient", disabledReason = "todo #2165, ES issue 286")
@Test // #1646, #1718
@DisplayName("should return a list of info for specific index")
void shouldReturnInformationListOfAllIndices() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,4 @@ IndexNameProvider indexNameProvider() {
return new IndexNameProvider("indexoperations");
}
}

@Override
public boolean newElasticsearchClient() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIf;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.NewElasticsearchClientDevelopment;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Mapping;
import org.springframework.data.elasticsearch.annotations.Setting;
Expand All @@ -52,7 +50,7 @@
* @author Peter-Josef Meisch
*/
@SpringIntegrationTest
public abstract class IndexOperationsIntegrationTests implements NewElasticsearchClientDevelopment {
public abstract class IndexOperationsIntegrationTests {

@Autowired private ElasticsearchOperations operations;
private IndexOperations indexOperations;
Expand All @@ -73,7 +71,6 @@ void cleanup() {
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete();
}

@DisabledIf(value = "newElasticsearchClient", disabledReason = "todo #2165, ES issue 286")
@Test // #1646, #1718
@DisplayName("should return a list of info for specific index")
void shouldReturnInformationList() throws JSONException {
Expand Down