The binary field shouldn't be stored by default, because it is already available in the _source.
This commit is contained in:
parent
b9707b395d
commit
0d9197a1d3
|
@ -59,7 +59,6 @@ public class BinaryFieldMapper extends AbstractFieldMapper<BytesReference> {
|
|||
|
||||
static {
|
||||
FIELD_TYPE.setIndexed(false);
|
||||
FIELD_TYPE.setStored(true);
|
||||
FIELD_TYPE.freeze();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package org.elasticsearch.index.mapper.binary;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.MapperTestUtils;
|
||||
import org.elasticsearch.index.mapper.core.BinaryFieldMapper;
|
||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class BinaryMappingTests extends ElasticsearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testDefaultMapping() throws Exception {
|
||||
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
|
||||
.startObject("properties")
|
||||
.startObject("field")
|
||||
.field("type", "binary")
|
||||
.endObject()
|
||||
.endObject()
|
||||
.endObject().endObject().string();
|
||||
|
||||
DocumentMapper mapper = MapperTestUtils.newParser().parse(mapping);
|
||||
|
||||
FieldMapper fieldMapper = mapper.mappers().smartNameFieldMapper("field");
|
||||
assertThat(fieldMapper, instanceOf(BinaryFieldMapper.class));
|
||||
assertThat(fieldMapper.fieldType().stored(), equalTo(false));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue