Skip to content

Commit

Permalink
Always write doc_values param to mapping for wildcard field (#16988)
Browse files Browse the repository at this point in the history
(cherry picked from commit cd149a9)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Jan 29, 2025
1 parent 53f7d97 commit 1fc1ce0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static final class Builder extends ParametrizedFieldMapper.Builder {
);
private final Parameter<String> normalizer = Parameter.stringParam("normalizer", false, m -> toType(m).normalizerName, "default");
private final Parameter<Map<String, String>> meta = Parameter.metaParam();
private final Parameter<Boolean> hasDocValues = Parameter.docValuesParam(m -> toType(m).hasDocValues, false);
private final Parameter<Boolean> hasDocValues = Parameter.docValuesParam(m -> toType(m).hasDocValues, false).alwaysSerialize();
private final IndexAnalyzers indexAnalyzers;

public Builder(String name, IndexAnalyzers indexAnalyzers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class WildcardFieldMapperTests extends MapperTestCase {
@Override
protected void minimalMapping(XContentBuilder b) throws IOException {
b.field("type", "wildcard");
b.field("doc_values", false);
}

@Override
Expand All @@ -59,7 +60,10 @@ protected void writeFieldValue(XContentBuilder builder) throws IOException {
@Override
protected void registerParameters(ParameterChecker checker) throws IOException {
checker.registerConflictCheck("normalizer", b -> b.field("normalizer", "lowercase"));
checker.registerConflictCheck("doc_values", b -> b.field("doc_values", true));
checker.registerConflictCheck("doc_values", fieldMapping(this::minimalMapping), fieldMapping(xcb -> {
xcb.field("type", "wildcard");
xcb.field("doc_values", true);
}));
checker.registerConflictCheck("null_value", b -> b.field("null_value", "foo"));
checker.registerUpdateCheck(b -> b.field("ignore_above", 256), m -> assertEquals(256, ((WildcardFieldMapper) m).ignoreAbove()));
}
Expand Down

0 comments on commit 1fc1ce0

Please sign in to comment.