mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-30 07:42:35 +00:00
Polishing
This commit is contained in:
parent
433d52981e
commit
b0c97ccf27
@ -121,8 +121,7 @@ class ResponseConverter {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private TemplateResponseData clusterGetComponentTemplateData(
|
private TemplateResponseData clusterGetComponentTemplateData(ComponentTemplateSummary componentTemplateSummary) {
|
||||||
ComponentTemplateSummary componentTemplateSummary) {
|
|
||||||
|
|
||||||
var mapping = typeMapping(componentTemplateSummary.mappings());
|
var mapping = typeMapping(componentTemplateSummary.mappings());
|
||||||
var settings = new Settings();
|
var settings = new Settings();
|
||||||
@ -326,7 +325,7 @@ class ResponseConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private TemplateResponseData indexGetComponentTemplateData(IndexTemplateSummary indexTemplateSummary,
|
private TemplateResponseData indexGetComponentTemplateData(IndexTemplateSummary indexTemplateSummary,
|
||||||
List<String> composedOf) {
|
List<String> composedOf) {
|
||||||
var mapping = typeMapping(indexTemplateSummary.mappings());
|
var mapping = typeMapping(indexTemplateSummary.mappings());
|
||||||
|
|
||||||
Function<IndexSettings, Settings> indexSettingsToSettings = indexSettings -> {
|
Function<IndexSettings, Settings> indexSettingsToSettings = indexSettings -> {
|
||||||
|
@ -169,11 +169,10 @@ class SearchDocumentResponseBuilder {
|
|||||||
|
|
||||||
private static SearchShardStatistics shardsFrom(ShardStatistics shards) {
|
private static SearchShardStatistics shardsFrom(ShardStatistics shards) {
|
||||||
List<ShardFailure> failures = shards.failures();
|
List<ShardFailure> failures = shards.failures();
|
||||||
List<SearchShardStatistics.Failure> searchFailures = failures.stream()
|
List<SearchShardStatistics.Failure> searchFailures = failures.stream().map(f -> SearchShardStatistics.Failure
|
||||||
.map(f -> SearchShardStatistics.Failure.of(f.index(), f.node(), f.status(), f.shard(), null,
|
.of(f.index(), f.node(), f.status(), f.shard(), null, ResponseConverter.toErrorCause(f.reason()))).toList();
|
||||||
ResponseConverter.toErrorCause(f.reason())))
|
return SearchShardStatistics.of(shards.failed(), shards.successful(), shards.total(), shards.skipped(),
|
||||||
.toList();
|
searchFailures);
|
||||||
return SearchShardStatistics.of(shards.failed(), shards.successful(), shards.total(), shards.skipped(), searchFailures);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -235,9 +234,8 @@ class SearchDocumentResponseBuilder {
|
|||||||
var phraseSuggest = suggestionES.phrase();
|
var phraseSuggest = suggestionES.phrase();
|
||||||
var phraseSuggestOptions = phraseSuggest.options();
|
var phraseSuggestOptions = phraseSuggest.options();
|
||||||
List<PhraseSuggestion.Entry.Option> options = new ArrayList<>();
|
List<PhraseSuggestion.Entry.Option> options = new ArrayList<>();
|
||||||
phraseSuggestOptions.forEach(optionES -> options
|
phraseSuggestOptions.forEach(optionES -> options.add(new PhraseSuggestion.Entry.Option(optionES.text(),
|
||||||
.add(new PhraseSuggestion.Entry.Option(optionES.text(), optionES.highlighted(), optionES.score(),
|
optionES.highlighted(), optionES.score(), optionES.collateMatch())));
|
||||||
optionES.collateMatch())));
|
|
||||||
entries.add(new PhraseSuggestion.Entry(phraseSuggest.text(), phraseSuggest.offset(), phraseSuggest.length(),
|
entries.add(new PhraseSuggestion.Entry(phraseSuggest.text(), phraseSuggest.offset(), phraseSuggest.length(),
|
||||||
options, null));
|
options, null));
|
||||||
});
|
});
|
||||||
|
@ -235,13 +235,13 @@ public class SearchHitMapping<T> {
|
|||||||
scrollId = searchHitsImpl.getScrollId();
|
scrollId = searchHitsImpl.getScrollId();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SearchHitsImpl<>(searchHits.getTotalHits(), //
|
return new SearchHitsImpl<>(searchHits.getTotalHits(),
|
||||||
searchHits.getTotalHitsRelation(), //
|
searchHits.getTotalHitsRelation(),
|
||||||
searchHits.getMaxScore(), //
|
searchHits.getMaxScore(),
|
||||||
scrollId, //
|
scrollId,
|
||||||
searchHits.getPointInTimeId(), //
|
searchHits.getPointInTimeId(),
|
||||||
convertedSearchHits, //
|
convertedSearchHits,
|
||||||
searchHits.getAggregations(), //
|
searchHits.getAggregations(),
|
||||||
searchHits.getSuggest(),
|
searchHits.getSuggest(),
|
||||||
searchHits.getSearchShardStatistics());
|
searchHits.getSearchShardStatistics());
|
||||||
}
|
}
|
||||||
|
@ -140,16 +140,12 @@ class SearchDocumentResponseBuilderUnitTests {
|
|||||||
.shard(1)
|
.shard(1)
|
||||||
.reason(rb -> rb
|
.reason(rb -> rb
|
||||||
.reason("this is a mock failure in shards")
|
.reason("this is a mock failure in shards")
|
||||||
.causedBy(cbb ->
|
.causedBy(cbb -> cbb.reason("inner reason")
|
||||||
cbb.reason("inner reason")
|
.metadata(Map.of("hello", JsonData.of("world"))))
|
||||||
.metadata(Map.of("hello", JsonData.of("world")))
|
|
||||||
)
|
|
||||||
.type("reason-type")
|
.type("reason-type")
|
||||||
|
|
||||||
)
|
)
|
||||||
.status("fail")
|
.status("fail"))))
|
||||||
)
|
|
||||||
))
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// act
|
// act
|
||||||
|
Loading…
x
Reference in New Issue
Block a user