Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The binary field shouldn't be stored by default, because it is alread…
…y available in the _source.
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/test/java/org/elasticsearch/index/mapper/binary/BinaryMappingTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
|
||
} |