inner hits: Use provided StreamContext instead of fetching a new one.

Closes #12905
This commit is contained in:
Martijn van Groningen 2015-08-16 23:38:20 +02:00
parent 754c1b44e7
commit 532806af1a
2 changed files with 6 additions and 7 deletions

View File

@ -694,9 +694,9 @@ public class InternalSearchHit implements SearchHit {
innerHits = new HashMap<>(size);
for (int i = 0; i < size; i++) {
String key = in.readString();
ShardTargetType shardTarget = InternalSearchHits.streamContext().streamShardTarget();
InternalSearchHits value = InternalSearchHits.readSearchHits(in, InternalSearchHits.streamContext().streamShardTarget(ShardTargetType.NO_STREAM));
InternalSearchHits.streamContext().streamShardTarget(shardTarget);
ShardTargetType shardTarget = context.streamShardTarget();
InternalSearchHits value = InternalSearchHits.readSearchHits(in, context.streamShardTarget(ShardTargetType.NO_STREAM));
context.streamShardTarget(shardTarget);
innerHits.put(key, value);
}
}
@ -810,9 +810,9 @@ public class InternalSearchHit implements SearchHit {
out.writeVInt(innerHits.size());
for (Map.Entry<String, InternalSearchHits> entry : innerHits.entrySet()) {
out.writeString(entry.getKey());
ShardTargetType shardTarget = InternalSearchHits.streamContext().streamShardTarget();
entry.getValue().writeTo(out, InternalSearchHits.streamContext().streamShardTarget(ShardTargetType.NO_STREAM));
InternalSearchHits.streamContext().streamShardTarget(shardTarget);
ShardTargetType shardTarget = context.streamShardTarget();
entry.getValue().writeTo(out, context.streamShardTarget(ShardTargetType.NO_STREAM));
context.streamShardTarget(shardTarget);
}
}
}

View File

@ -49,7 +49,6 @@ import static org.hamcrest.Matchers.*;
/**
*/
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/12905")
public class InnerHitsIT extends ESIntegTestCase {
@Test