Optimize restore source JSON serialization

Don't print "restore_source":  null if restore source is null, omit entire line instead
This commit is contained in:
Igor Motov 2013-12-21 22:12:12 -05:00
parent 9b9ad1a603
commit d92f573404
1 changed files with 2 additions and 4 deletions

View File

@ -341,12 +341,10 @@ public class ImmutableShardRouting implements Streamable, Serializable, ShardRou
.field("node", currentNodeId())
.field("relocating_node", relocatingNodeId())
.field("shard", shardId().id())
.field("index", shardId().index().name())
.field("restore_source");
.field("index", shardId().index().name());
if (restoreSource() != null) {
builder.field("restore_source");
restoreSource().toXContent(builder, params);
} else {
builder.nullValue();
}
return builder.endObject();
}