Avoid uid creation in ParsedDocument (#27241)

The uid bytes (as the type#id) were needlessly being created even though
they are no longer needed after the move to single type per index. This
commit avoids creating these when parsed documents are constructed.

Relates #27241
This commit is contained in:
Mathias Fußenegger 2017-11-03 01:10:07 +01:00 committed by Jason Tedor
parent 55b9dfdd52
commit 827ba7f82d
1 changed files with 1 additions and 6 deletions

View File

@ -20,7 +20,6 @@
package org.elasticsearch.index.mapper; package org.elasticsearch.index.mapper;
import org.apache.lucene.document.Field; import org.apache.lucene.document.Field;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.ParseContext.Document; import org.elasticsearch.index.mapper.ParseContext.Document;
@ -35,7 +34,6 @@ public class ParsedDocument {
private final Field version; private final Field version;
private final String id, type; private final String id, type;
private final BytesRef uid;
private final SeqNoFieldMapper.SequenceIDFields seqID; private final SeqNoFieldMapper.SequenceIDFields seqID;
private final String routing; private final String routing;
@ -62,7 +60,6 @@ public class ParsedDocument {
this.seqID = seqID; this.seqID = seqID;
this.id = id; this.id = id;
this.type = type; this.type = type;
this.uid = Uid.createUidAsBytes(type, id);
this.routing = routing; this.routing = routing;
this.documents = documents; this.documents = documents;
this.source = source; this.source = source;
@ -140,9 +137,7 @@ public class ParsedDocument {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); return "Document uid[" + Uid.createUidAsBytes(type, id) + "] doc [" + documents + ']';
sb.append("Document ").append("uid[").append(uid).append("] doc [").append(documents).append("]");
return sb.toString();
} }
} }