Skip to content

Commit 68ae924

Browse files
committed
The binary field shouldn't be stored by default, because it is already available in the _source.
1 parent 17ddc08 commit 68ae924

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public static class Defaults extends AbstractFieldMapper.Defaults {
5959

6060
static {
6161
FIELD_TYPE.setIndexed(false);
62-
FIELD_TYPE.setStored(true);
6362
FIELD_TYPE.freeze();
6463
}
6564
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package org.elasticsearch.index.mapper.binary;
2+
3+
import org.elasticsearch.common.xcontent.XContentFactory;
4+
import org.elasticsearch.index.mapper.DocumentMapper;
5+
import org.elasticsearch.index.mapper.FieldMapper;
6+
import org.elasticsearch.index.mapper.MapperTestUtils;
7+
import org.elasticsearch.index.mapper.core.BinaryFieldMapper;
8+
import org.elasticsearch.test.ElasticsearchTestCase;
9+
import org.junit.Test;
10+
11+
import static org.hamcrest.Matchers.equalTo;
12+
import static org.hamcrest.Matchers.instanceOf;
13+
14+
/**
15+
*/
16+
public class BinaryMappingTests extends ElasticsearchTestCase {
17+
18+
@Test
19+
public void testDefaultMapping() throws Exception {
20+
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
21+
.startObject("properties")
22+
.startObject("field")
23+
.field("type", "binary")
24+
.endObject()
25+
.endObject()
26+
.endObject().endObject().string();
27+
28+
DocumentMapper mapper = MapperTestUtils.newParser().parse(mapping);
29+
30+
FieldMapper fieldMapper = mapper.mappers().smartNameFieldMapper("field");
31+
assertThat(fieldMapper, instanceOf(BinaryFieldMapper.class));
32+
assertThat(fieldMapper.fieldType().stored(), equalTo(false));
33+
}
34+
35+
}

0 commit comments

Comments
 (0)