Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Binary field is stored by default, allow to disable it, closes #1919.

  • Loading branch information...
commit 2ca2db4e62b92245cc164e36fc0cd9baccd85c00 1 parent 48722b0
@kimchy kimchy authored
View
11 src/main/java/org/elasticsearch/index/mapper/core/BinaryFieldMapper.java
@@ -49,6 +49,7 @@
public static class Defaults extends AbstractFieldMapper.Defaults {
public static final long COMPRESS_THRESHOLD = -1;
+ public static final Field.Store STORE = Field.Store.YES;
}
public static class Builder extends AbstractFieldMapper.Builder<Builder, BinaryFieldMapper> {
@@ -59,6 +60,7 @@
public Builder(String name) {
super(name);
+ store = Defaults.STORE;
builder = this;
}
@@ -79,7 +81,7 @@ public Builder indexName(String indexName) {
@Override
public BinaryFieldMapper build(BuilderContext context) {
- return new BinaryFieldMapper(buildNames(context), compress, compressThreshold);
+ return new BinaryFieldMapper(buildNames(context), store, compress, compressThreshold);
}
}
@@ -111,8 +113,8 @@ public BinaryFieldMapper build(BuilderContext context) {
private long compressThreshold;
- protected BinaryFieldMapper(Names names, Boolean compress, long compressThreshold) {
- super(names, Field.Index.NO, Field.Store.YES, Field.TermVector.NO, 1.0f, true, true, null, null);
+ protected BinaryFieldMapper(Names names, Field.Store store, Boolean compress, long compressThreshold) {
+ super(names, Field.Index.NO, store, Field.TermVector.NO, 1.0f, true, true, null, null);
this.compress = compress;
this.compressThreshold = compressThreshold;
}
@@ -157,6 +159,9 @@ public String indexedValue(String value) {
@Override
protected Field parseCreateField(ParseContext context) throws IOException {
+ if (!stored()) {
+ return null;
+ }
byte[] value;
if (context.parser().currentToken() == XContentParser.Token.VALUE_NULL) {
return null;
Please sign in to comment.
Something went wrong with that request. Please try again.