Skip to content

Commit 409306e

Browse files
authored
Correct default formatting of binary fields (#58338)
This was picked up in the backport of #57666 but missed in the original commit on master, leading to failures such as #58282
1 parent 1e5ba7b commit 409306e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

server/src/main/java/org/elasticsearch/index/mapper/BinaryFieldMapper.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public static class Builder extends FieldMapper.Builder<Builder> {
6767

6868
public Builder(String name) {
6969
super(name, Defaults.FIELD_TYPE);
70+
hasDocValues = false;
7071
builder = this;
7172
}
7273

@@ -207,6 +208,16 @@ protected void parseCreateField(ParseContext context) throws IOException {
207208

208209
}
209210

211+
@Override
212+
protected boolean indexedByDefault() {
213+
return false;
214+
}
215+
216+
@Override
217+
protected boolean docValuesByDefault() {
218+
return false;
219+
}
220+
210221
@Override
211222
protected void mergeOptions(FieldMapper other, List<String> conflicts) {
212223

server/src/test/java/org/elasticsearch/index/mapper/BinaryFieldMapperTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public void testDefaultMapping() throws Exception {
7474

7575
assertThat(mapper, instanceOf(BinaryFieldMapper.class));
7676
assertThat(mapper.fieldType.stored(), equalTo(false));
77+
78+
assertEquals(Strings.toString(mapping), Strings.toString(mapperService.documentMapper()));
7779
}
7880

7981
public void testStoredValue() throws IOException {

0 commit comments

Comments
 (0)