mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-17 09:32:11 +00:00
parent
120ca8579f
commit
eabde9c543
@ -1252,9 +1252,15 @@ class RequestConverter {
|
||||
|
||||
Map<String, RuntimeField> runtimeMappings = new HashMap<>();
|
||||
query.getRuntimeFields()
|
||||
.forEach(runtimeField -> runtimeMappings.put(runtimeField.getName(), RuntimeField.of(rt -> rt //
|
||||
.type(RuntimeFieldType._DESERIALIZER.parse(runtimeField.getType())) //
|
||||
.script(s -> s.inline(is -> is.source(runtimeField.getScript()))))));
|
||||
.forEach(runtimeField -> runtimeMappings.put(runtimeField.getName(), RuntimeField.of(runtimeFieldBuilder -> {
|
||||
runtimeFieldBuilder.type(RuntimeFieldType._DESERIALIZER.parse(runtimeField.getType()));
|
||||
String script = runtimeField.getScript();
|
||||
|
||||
if (script != null) {
|
||||
runtimeFieldBuilder.script(s -> s.inline(is -> is.source(script)));
|
||||
}
|
||||
return runtimeFieldBuilder;
|
||||
})));
|
||||
builder.runtimeMappings(runtimeMappings);
|
||||
}
|
||||
|
||||
|
@ -37,9 +37,4 @@ public class RuntimeFieldsELCIntegrationTests extends RuntimeFieldsIntegrationTe
|
||||
return new IndexNameProvider("runtime-fields-rest-template");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean newElasticsearchClient() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
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.data.annotation.Id;
|
||||
import org.springframework.data.elasticsearch.NewElasticsearchClientDevelopment;
|
||||
@ -41,7 +40,7 @@ import org.springframework.lang.Nullable;
|
||||
* @author cdalxndr
|
||||
*/
|
||||
@SpringIntegrationTest
|
||||
public abstract class RuntimeFieldsIntegrationTests implements NewElasticsearchClientDevelopment {
|
||||
public abstract class RuntimeFieldsIntegrationTests {
|
||||
|
||||
@Autowired private ElasticsearchOperations operations;
|
||||
@Autowired protected IndexNameProvider indexNameProvider;
|
||||
@ -61,7 +60,6 @@ public abstract class RuntimeFieldsIntegrationTests implements NewElasticsearchC
|
||||
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete();
|
||||
}
|
||||
|
||||
@DisabledIf(value = "newElasticsearchClient", disabledReason = "todo #2171, ES issue 298")
|
||||
@Test // #1971
|
||||
@DisplayName("should use runtime-field from query in search")
|
||||
void shouldUseRuntimeFieldFromQueryInSearch() {
|
||||
@ -78,7 +76,6 @@ public abstract class RuntimeFieldsIntegrationTests implements NewElasticsearchC
|
||||
assertThat(searchHits.getSearchHit(0).getId()).isEqualTo("2");
|
||||
}
|
||||
|
||||
@DisabledIf(value = "newElasticsearchClient", disabledReason = "todo #2171, ES issue 298")
|
||||
@Test // #2267
|
||||
@DisplayName("should use runtime-field without script")
|
||||
void shouldUseRuntimeFieldWithoutScript() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user