Internal: adjusted BroadcastShardOperationResponse subclasses visibility
Also replaced int,String pair with ShardId that holds the same info and serializes it the same way. Replaced shardId and index getters in BroadcastOperationRequest with a single ShardId getter. Closes #7255
This commit is contained in:
parent
0b6734aa40
commit
4d05d1d7b0
|
@ -46,8 +46,8 @@ public class SnapshotIndexShardStatus extends BroadcastShardOperationResponse im
|
||||||
private SnapshotIndexShardStatus() {
|
private SnapshotIndexShardStatus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SnapshotIndexShardStatus(String index, int shardId, SnapshotIndexShardStage stage) {
|
SnapshotIndexShardStatus(ShardId shardId, SnapshotIndexShardStage stage) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
this.stats = new SnapshotStats();
|
this.stats = new SnapshotStats();
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class SnapshotIndexShardStatus extends BroadcastShardOperationResponse im
|
||||||
}
|
}
|
||||||
|
|
||||||
SnapshotIndexShardStatus(ShardId shardId, IndexShardSnapshotStatus indexShardStatus, String nodeId) {
|
SnapshotIndexShardStatus(ShardId shardId, IndexShardSnapshotStatus indexShardStatus, String nodeId) {
|
||||||
super(shardId.getIndex(), shardId.getId());
|
super(shardId);
|
||||||
switch (indexShardStatus.stage()) {
|
switch (indexShardStatus.stage()) {
|
||||||
case INIT:
|
case INIT:
|
||||||
stage = SnapshotIndexShardStage.INIT;
|
stage = SnapshotIndexShardStage.INIT;
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class TransportSnapshotsStatusAction extends TransportMasterNodeOperation
|
||||||
default:
|
default:
|
||||||
throw new ElasticsearchIllegalArgumentException("Unknown snapshot state " + shardEntry.getValue().state());
|
throw new ElasticsearchIllegalArgumentException("Unknown snapshot state " + shardEntry.getValue().state());
|
||||||
}
|
}
|
||||||
SnapshotIndexShardStatus shardStatus = new SnapshotIndexShardStatus(shardEntry.getKey().getIndex(), shardEntry.getKey().getId(), stage);
|
SnapshotIndexShardStatus shardStatus = new SnapshotIndexShardStatus(shardEntry.getKey(), stage);
|
||||||
shardStatusBuilder.add(shardStatus);
|
shardStatusBuilder.add(shardStatus);
|
||||||
}
|
}
|
||||||
builder.add(new SnapshotStatus(entry.snapshotId(), entry.state(), shardStatusBuilder.build()));
|
builder.add(new SnapshotStatus(entry.snapshotId(), entry.state(), shardStatusBuilder.build()));
|
||||||
|
|
|
@ -20,10 +20,7 @@
|
||||||
package org.elasticsearch.action.admin.indices.cache.clear;
|
package org.elasticsearch.action.admin.indices.cache.clear;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -33,17 +30,7 @@ class ShardClearIndicesCacheResponse extends BroadcastShardOperationResponse {
|
||||||
ShardClearIndicesCacheResponse() {
|
ShardClearIndicesCacheResponse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardClearIndicesCacheResponse(String index, int shardId) {
|
ShardClearIndicesCacheResponse(ShardId shardId) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
|
||||||
super.readFrom(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -115,9 +115,9 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardClearIndicesCacheResponse shardOperation(ShardClearIndicesCacheRequest request) throws ElasticsearchException {
|
protected ShardClearIndicesCacheResponse shardOperation(ShardClearIndicesCacheRequest request) throws ElasticsearchException {
|
||||||
IndexService service = indicesService.indexService(request.index());
|
IndexService service = indicesService.indexService(request.shardId().getIndex());
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
IndexShard shard = service.shard(request.shardId());
|
IndexShard shard = service.shard(request.shardId().id());
|
||||||
// we always clear the query cache
|
// we always clear the query cache
|
||||||
service.cache().queryParserCache().clear();
|
service.cache().queryParserCache().clear();
|
||||||
boolean clearedAtLeastOne = false;
|
boolean clearedAtLeastOne = false;
|
||||||
|
@ -168,7 +168,7 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ShardClearIndicesCacheResponse(request.index(), request.shardId());
|
return new ShardClearIndicesCacheResponse(request.shardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,10 +20,7 @@
|
||||||
package org.elasticsearch.action.admin.indices.flush;
|
package org.elasticsearch.action.admin.indices.flush;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -34,17 +31,7 @@ class ShardFlushResponse extends BroadcastShardOperationResponse {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardFlushResponse(String index, int shardId) {
|
ShardFlushResponse(ShardId shardId) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
|
||||||
super.readFrom(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -106,10 +106,10 @@ public class TransportFlushAction extends TransportBroadcastOperationAction<Flus
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardFlushResponse shardOperation(ShardFlushRequest request) throws ElasticsearchException {
|
protected ShardFlushResponse shardOperation(ShardFlushRequest request) throws ElasticsearchException {
|
||||||
IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
|
IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().getIndex()).shardSafe(request.shardId().id());
|
||||||
indexShard.flush(new Engine.Flush().waitIfOngoing(request.waitIfOngoing()).
|
indexShard.flush(new Engine.Flush().waitIfOngoing(request.waitIfOngoing()).
|
||||||
type(request.full() ? Engine.Flush.Type.NEW_WRITER : Engine.Flush.Type.COMMIT_TRANSLOG).force(request.force()));
|
type(request.full() ? Engine.Flush.Type.NEW_WRITER : Engine.Flush.Type.COMMIT_TRANSLOG).force(request.force()));
|
||||||
return new ShardFlushResponse(request.index(), request.shardId());
|
return new ShardFlushResponse(request.shardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,10 +20,7 @@
|
||||||
package org.elasticsearch.action.admin.indices.optimize;
|
package org.elasticsearch.action.admin.indices.optimize;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -33,17 +30,7 @@ class ShardOptimizeResponse extends BroadcastShardOperationResponse {
|
||||||
ShardOptimizeResponse() {
|
ShardOptimizeResponse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardOptimizeResponse(String index, int shardId) {
|
ShardOptimizeResponse(ShardId shardId) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
|
||||||
super.readFrom(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -107,7 +107,7 @@ public class TransportOptimizeAction extends TransportBroadcastOperationAction<O
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardOptimizeResponse shardOperation(ShardOptimizeRequest request) throws ElasticsearchException {
|
protected ShardOptimizeResponse shardOperation(ShardOptimizeRequest request) throws ElasticsearchException {
|
||||||
IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
|
IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().getIndex()).shardSafe(request.shardId().id());
|
||||||
indexShard.optimize(new Engine.Optimize()
|
indexShard.optimize(new Engine.Optimize()
|
||||||
.waitForMerge(request.waitForMerge())
|
.waitForMerge(request.waitForMerge())
|
||||||
.maxNumSegments(request.maxNumSegments())
|
.maxNumSegments(request.maxNumSegments())
|
||||||
|
@ -115,7 +115,7 @@ public class TransportOptimizeAction extends TransportBroadcastOperationAction<O
|
||||||
.flush(request.flush())
|
.flush(request.flush())
|
||||||
.force(request.force())
|
.force(request.force())
|
||||||
);
|
);
|
||||||
return new ShardOptimizeResponse(request.index(), request.shardId());
|
return new ShardOptimizeResponse(request.shardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,10 +20,11 @@
|
||||||
package org.elasticsearch.action.admin.indices.recovery;
|
package org.elasticsearch.action.admin.indices.recovery;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.indices.recovery.RecoveryState;
|
import org.elasticsearch.indices.recovery.RecoveryState;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -41,11 +42,10 @@ public class ShardRecoveryResponse extends BroadcastShardOperationResponse imple
|
||||||
/**
|
/**
|
||||||
* Constructs shard recovery information for the given index and shard id.
|
* Constructs shard recovery information for the given index and shard id.
|
||||||
*
|
*
|
||||||
* @param index Name of the index
|
|
||||||
* @param shardId Id of the shard
|
* @param shardId Id of the shard
|
||||||
*/
|
*/
|
||||||
public ShardRecoveryResponse(String index, int shardId) {
|
ShardRecoveryResponse(ShardId shardId) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -142,10 +142,10 @@ public class TransportRecoveryAction extends
|
||||||
@Override
|
@Override
|
||||||
protected ShardRecoveryResponse shardOperation(ShardRecoveryRequest request) throws ElasticsearchException {
|
protected ShardRecoveryResponse shardOperation(ShardRecoveryRequest request) throws ElasticsearchException {
|
||||||
|
|
||||||
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.index());
|
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.shardId().getIndex());
|
||||||
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId());
|
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId().id());
|
||||||
ShardRouting shardRouting = indexShard.routingEntry();
|
ShardRouting shardRouting = indexShard.routingEntry();
|
||||||
ShardRecoveryResponse shardRecoveryResponse = new ShardRecoveryResponse(shardRouting.index(), shardRouting.id());
|
ShardRecoveryResponse shardRecoveryResponse = new ShardRecoveryResponse(request.shardId());
|
||||||
|
|
||||||
RecoveryState state;
|
RecoveryState state;
|
||||||
RecoveryStatus recoveryStatus = indexShard.recoveryStatus();
|
RecoveryStatus recoveryStatus = indexShard.recoveryStatus();
|
||||||
|
@ -158,7 +158,7 @@ public class TransportRecoveryAction extends
|
||||||
state = recoveryStatus.recoveryState();
|
state = recoveryStatus.recoveryState();
|
||||||
} else {
|
} else {
|
||||||
IndexShardGatewayService gatewayService =
|
IndexShardGatewayService gatewayService =
|
||||||
indexService.shardInjector(request.shardId()).getInstance(IndexShardGatewayService.class);
|
indexService.shardInjector(request.shardId().id()).getInstance(IndexShardGatewayService.class);
|
||||||
state = gatewayService.recoveryState();
|
state = gatewayService.recoveryState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,7 @@
|
||||||
package org.elasticsearch.action.admin.indices.refresh;
|
package org.elasticsearch.action.admin.indices.refresh;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -33,17 +30,7 @@ class ShardRefreshResponse extends BroadcastShardOperationResponse {
|
||||||
ShardRefreshResponse() {
|
ShardRefreshResponse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardRefreshResponse(String index, int shardId) {
|
ShardRefreshResponse(ShardId shardId) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
|
||||||
super.readFrom(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -107,10 +107,10 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardRefreshResponse shardOperation(ShardRefreshRequest request) throws ElasticsearchException {
|
protected ShardRefreshResponse shardOperation(ShardRefreshRequest request) throws ElasticsearchException {
|
||||||
IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
|
IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().getIndex()).shardSafe(request.shardId().id());
|
||||||
indexShard.refresh(new Engine.Refresh("api").force(request.force()));
|
indexShard.refresh(new Engine.Refresh("api").force(request.force()));
|
||||||
logger.trace("{} refresh request executed, force: [{}]", indexShard.shardId(), request.force());
|
logger.trace("{} refresh request executed, force: [{}]", indexShard.shardId(), request.force());
|
||||||
return new ShardRefreshResponse(request.index(), request.shardId());
|
return new ShardRefreshResponse(request.shardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,8 +42,8 @@ public class ShardSegments extends BroadcastShardOperationResponse implements It
|
||||||
ShardSegments() {
|
ShardSegments() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardSegments(ShardRouting shardRouting, List<Segment> segments) {
|
ShardSegments(ShardRouting shardRouting, List<Segment> segments) {
|
||||||
super(shardRouting.index(), shardRouting.id());
|
super(shardRouting.shardId());
|
||||||
this.shardRouting = shardRouting;
|
this.shardRouting = shardRouting;
|
||||||
this.segments = segments;
|
this.segments = segments;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,8 +129,8 @@ public class TransportIndicesSegmentsAction extends TransportBroadcastOperationA
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardSegments shardOperation(IndexShardSegmentRequest request) throws ElasticsearchException {
|
protected ShardSegments shardOperation(IndexShardSegmentRequest request) throws ElasticsearchException {
|
||||||
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.index());
|
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.shardId().getIndex());
|
||||||
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId());
|
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId().id());
|
||||||
return new ShardSegments(indexShard.routingEntry(), indexShard.engine().segments());
|
return new ShardSegments(indexShard.routingEntry(), indexShard.engine().segments());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ShardStats extends BroadcastShardOperationResponse implements ToXCo
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardStats(IndexShard indexShard, CommonStatsFlags flags) {
|
public ShardStats(IndexShard indexShard, CommonStatsFlags flags) {
|
||||||
super(indexShard.routingEntry().index(), indexShard.routingEntry().id());
|
super(indexShard.routingEntry().shardId());
|
||||||
this.shardRouting = indexShard.routingEntry();
|
this.shardRouting = indexShard.routingEntry();
|
||||||
this.stats = new CommonStats(indexShard, flags);
|
this.stats = new CommonStats(indexShard, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,8 +133,8 @@ public class TransportIndicesStatsAction extends TransportBroadcastOperationActi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardStats shardOperation(IndexShardStatsRequest request) throws ElasticsearchException {
|
protected ShardStats shardOperation(IndexShardStatsRequest request) throws ElasticsearchException {
|
||||||
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.index());
|
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.shardId().getIndex());
|
||||||
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId());
|
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId().id());
|
||||||
|
|
||||||
CommonStatsFlags flags = new CommonStatsFlags().clear();
|
CommonStatsFlags flags = new CommonStatsFlags().clear();
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.action.admin.indices.validate.query;
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -42,8 +43,8 @@ class ShardValidateQueryResponse extends BroadcastShardOperationResponse {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardValidateQueryResponse(String index, int shardId, boolean valid, String explanation, String error) {
|
ShardValidateQueryResponse(ShardId shardId, boolean valid, String explanation, String error) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
this.valid = valid;
|
this.valid = valid;
|
||||||
this.explanation = explanation;
|
this.explanation = explanation;
|
||||||
this.error = error;
|
this.error = error;
|
||||||
|
|
|
@ -170,9 +170,9 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardValidateQueryResponse shardOperation(ShardValidateQueryRequest request) throws ElasticsearchException {
|
protected ShardValidateQueryResponse shardOperation(ShardValidateQueryRequest request) throws ElasticsearchException {
|
||||||
IndexQueryParserService queryParserService = indicesService.indexServiceSafe(request.index()).queryParserService();
|
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
|
||||||
IndexService indexService = indicesService.indexServiceSafe(request.index());
|
IndexQueryParserService queryParserService = indexService.queryParserService();
|
||||||
IndexShard indexShard = indexService.shardSafe(request.shardId());
|
IndexShard indexShard = indexService.shardSafe(request.shardId().id());
|
||||||
|
|
||||||
boolean valid;
|
boolean valid;
|
||||||
String explanation = null;
|
String explanation = null;
|
||||||
|
@ -206,6 +206,6 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
|
||||||
SearchContext.removeCurrent();
|
SearchContext.removeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ShardValidateQueryResponse(request.index(), request.shardId(), valid, explanation, error);
|
return new ShardValidateQueryResponse(request.shardId(), valid, explanation, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -40,8 +41,8 @@ class ShardCountResponse extends BroadcastShardOperationResponse {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardCountResponse(String index, int shardId, long count, boolean terminatedEarly) {
|
ShardCountResponse(ShardId shardId, long count, boolean terminatedEarly) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
this.count = count;
|
this.count = count;
|
||||||
this.terminatedEarly = terminatedEarly;
|
this.terminatedEarly = terminatedEarly;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,10 +165,10 @@ public class TransportCountAction extends TransportBroadcastOperationAction<Coun
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardCountResponse shardOperation(ShardCountRequest request) throws ElasticsearchException {
|
protected ShardCountResponse shardOperation(ShardCountRequest request) throws ElasticsearchException {
|
||||||
IndexService indexService = indicesService.indexServiceSafe(request.index());
|
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
|
||||||
IndexShard indexShard = indexService.shardSafe(request.shardId());
|
IndexShard indexShard = indexService.shardSafe(request.shardId().id());
|
||||||
|
|
||||||
SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().id(), request.index(), request.shardId());
|
SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().id(), request.shardId().getIndex(), request.shardId().id());
|
||||||
SearchContext context = new DefaultSearchContext(0,
|
SearchContext context = new DefaultSearchContext(0,
|
||||||
new ShardSearchRequest().types(request.types())
|
new ShardSearchRequest().types(request.types())
|
||||||
.filteringAliases(request.filteringAliases())
|
.filteringAliases(request.filteringAliases())
|
||||||
|
@ -204,7 +204,7 @@ public class TransportCountAction extends TransportBroadcastOperationAction<Coun
|
||||||
} else {
|
} else {
|
||||||
count = Lucene.count(context.searcher(), context.query());
|
count = Lucene.count(context.searcher(), context.query());
|
||||||
}
|
}
|
||||||
return new ShardCountResponse(request.index(), request.shardId(), count, terminatedEarly);
|
return new ShardCountResponse(request.shardId(), count, terminatedEarly);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new QueryPhaseExecutionException(context, "failed to execute count", e);
|
throw new QueryPhaseExecutionException(context, "failed to execute count", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,18 +22,19 @@ package org.elasticsearch.action.exists;
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class ShardExistsResponse extends BroadcastShardOperationResponse {
|
class ShardExistsResponse extends BroadcastShardOperationResponse {
|
||||||
|
|
||||||
private boolean exists;
|
private boolean exists;
|
||||||
|
|
||||||
ShardExistsResponse() {
|
ShardExistsResponse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardExistsResponse(String index, int shardId, boolean exists) {
|
ShardExistsResponse(ShardId shardId, boolean exists) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
this.exists = exists;
|
this.exists = exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,10 +166,10 @@ public class TransportExistsAction extends TransportBroadcastOperationAction<Exi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardExistsResponse shardOperation(ShardExistsRequest request) throws ElasticsearchException {
|
protected ShardExistsResponse shardOperation(ShardExistsRequest request) throws ElasticsearchException {
|
||||||
IndexService indexService = indicesService.indexServiceSafe(request.index());
|
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
|
||||||
IndexShard indexShard = indexService.shardSafe(request.shardId());
|
IndexShard indexShard = indexService.shardSafe(request.shardId().id());
|
||||||
|
|
||||||
SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().id(), request.index(), request.shardId());
|
SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().id(), request.shardId().getIndex(), request.shardId().id());
|
||||||
SearchContext context = new DefaultSearchContext(0,
|
SearchContext context = new DefaultSearchContext(0,
|
||||||
new ShardSearchRequest().types(request.types())
|
new ShardSearchRequest().types(request.types())
|
||||||
.filteringAliases(request.filteringAliases())
|
.filteringAliases(request.filteringAliases())
|
||||||
|
@ -195,7 +195,7 @@ public class TransportExistsAction extends TransportBroadcastOperationAction<Exi
|
||||||
try {
|
try {
|
||||||
Lucene.EarlyTerminatingCollector existsCollector = Lucene.createExistsCollector();
|
Lucene.EarlyTerminatingCollector existsCollector = Lucene.createExistsCollector();
|
||||||
Lucene.exists(context.searcher(), context.query(), existsCollector);
|
Lucene.exists(context.searcher(), context.query(), existsCollector);
|
||||||
return new ShardExistsResponse(request.index(), request.shardId(), existsCollector.exists());
|
return new ShardExistsResponse(request.shardId(), existsCollector.exists());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new QueryPhaseExecutionException(context, "failed to execute exists", e);
|
throw new QueryPhaseExecutionException(context, "failed to execute exists", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.util.BytesRef;
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.percolator.PercolateContext;
|
import org.elasticsearch.percolator.PercolateContext;
|
||||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||||
import org.elasticsearch.search.facet.InternalFacets;
|
import org.elasticsearch.search.facet.InternalFacets;
|
||||||
|
@ -57,8 +58,8 @@ public class PercolateShardResponse extends BroadcastShardOperationResponse {
|
||||||
hls = new ArrayList<>();
|
hls = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PercolateShardResponse(BytesRef[] matches, List<Map<String, HighlightField>> hls, long count, float[] scores, PercolateContext context, String index, int shardId) {
|
public PercolateShardResponse(BytesRef[] matches, List<Map<String, HighlightField>> hls, long count, float[] scores, PercolateContext context, ShardId shardId) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
this.matches = matches;
|
this.matches = matches;
|
||||||
this.hls = hls;
|
this.hls = hls;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
|
@ -76,20 +77,20 @@ public class PercolateShardResponse extends BroadcastShardOperationResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PercolateShardResponse(BytesRef[] matches, long count, float[] scores, PercolateContext context, String index, int shardId) {
|
public PercolateShardResponse(BytesRef[] matches, long count, float[] scores, PercolateContext context, ShardId shardId) {
|
||||||
this(matches, EMPTY_HL, count, scores, context, index, shardId);
|
this(matches, EMPTY_HL, count, scores, context, shardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PercolateShardResponse(BytesRef[] matches, List<Map<String, HighlightField>> hls, long count, PercolateContext context, String index, int shardId) {
|
public PercolateShardResponse(BytesRef[] matches, List<Map<String, HighlightField>> hls, long count, PercolateContext context, ShardId shardId) {
|
||||||
this(matches, hls, count, EMPTY_SCORES, context, index, shardId);
|
this(matches, hls, count, EMPTY_SCORES, context, shardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PercolateShardResponse(long count, PercolateContext context, String index, int shardId) {
|
public PercolateShardResponse(long count, PercolateContext context, ShardId shardId) {
|
||||||
this(EMPTY_MATCHES, EMPTY_HL, count, EMPTY_SCORES, context, index, shardId);
|
this(EMPTY_MATCHES, EMPTY_HL, count, EMPTY_SCORES, context, shardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PercolateShardResponse(PercolateContext context, String index, int shardId) {
|
public PercolateShardResponse(PercolateContext context, ShardId shardId) {
|
||||||
this(EMPTY_MATCHES, EMPTY_HL, 0, EMPTY_SCORES, context, index, shardId);
|
this(EMPTY_MATCHES, EMPTY_HL, 0, EMPTY_SCORES, context, shardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BytesRef[] matches() {
|
public BytesRef[] matches() {
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.index.engine.DocumentMissingException;
|
import org.elasticsearch.index.engine.DocumentMissingException;
|
||||||
import org.elasticsearch.index.shard.ShardId;
|
|
||||||
import org.elasticsearch.percolator.PercolateException;
|
import org.elasticsearch.percolator.PercolateException;
|
||||||
import org.elasticsearch.percolator.PercolatorService;
|
import org.elasticsearch.percolator.PercolatorService;
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
|
@ -189,9 +188,8 @@ public class TransportPercolateAction extends TransportBroadcastOperationAction<
|
||||||
try {
|
try {
|
||||||
return percolatorService.percolate(request);
|
return percolatorService.percolate(request);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.trace("[{}][{}] failed to percolate", e, request.index(), request.shardId());
|
logger.trace("{} failed to percolate", e, request.shardId());
|
||||||
ShardId shardId = new ShardId(request.index(), request.shardId());
|
throw new PercolateException(request.shardId(), "failed to percolate", e);
|
||||||
throw new PercolateException(shardId, "failed to percolate", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.action.suggest;
|
||||||
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
import org.elasticsearch.action.support.broadcast.BroadcastShardOperationResponse;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.search.suggest.Suggest;
|
import org.elasticsearch.search.suggest.Suggest;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -37,8 +38,8 @@ class ShardSuggestResponse extends BroadcastShardOperationResponse {
|
||||||
this.suggest = new Suggest();
|
this.suggest = new Suggest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShardSuggestResponse(String index, int shardId, Suggest suggest) {
|
ShardSuggestResponse(ShardId shardId, Suggest suggest) {
|
||||||
super(index, shardId);
|
super(shardId);
|
||||||
this.suggest = suggest;
|
this.suggest = suggest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,8 +144,8 @@ public class TransportSuggestAction extends TransportBroadcastOperationAction<Su
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ShardSuggestResponse shardOperation(ShardSuggestRequest request) throws ElasticsearchException {
|
protected ShardSuggestResponse shardOperation(ShardSuggestRequest request) throws ElasticsearchException {
|
||||||
IndexService indexService = indicesService.indexServiceSafe(request.index());
|
IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
|
||||||
IndexShard indexShard = indexService.shardSafe(request.shardId());
|
IndexShard indexShard = indexService.shardSafe(request.shardId().id());
|
||||||
final Engine.Searcher searcher = indexShard.acquireSearcher("suggest");
|
final Engine.Searcher searcher = indexShard.acquireSearcher("suggest");
|
||||||
ShardSuggestService shardSuggestService = indexShard.shardSuggestService();
|
ShardSuggestService shardSuggestService = indexShard.shardSuggestService();
|
||||||
shardSuggestService.preSuggest();
|
shardSuggestService.preSuggest();
|
||||||
|
@ -158,11 +158,11 @@ public class TransportSuggestAction extends TransportBroadcastOperationAction<Su
|
||||||
if (parser.nextToken() != XContentParser.Token.START_OBJECT) {
|
if (parser.nextToken() != XContentParser.Token.START_OBJECT) {
|
||||||
throw new ElasticsearchIllegalArgumentException("suggest content missing");
|
throw new ElasticsearchIllegalArgumentException("suggest content missing");
|
||||||
}
|
}
|
||||||
final SuggestionSearchContext context = suggestPhase.parseElement().parseInternal(parser, indexService.mapperService(), request.index(), request.shardId());
|
final SuggestionSearchContext context = suggestPhase.parseElement().parseInternal(parser, indexService.mapperService(), request.shardId().getIndex(), request.shardId().id());
|
||||||
final Suggest result = suggestPhase.execute(context, searcher.reader());
|
final Suggest result = suggestPhase.execute(context, searcher.reader());
|
||||||
return new ShardSuggestResponse(request.index(), request.shardId(), result);
|
return new ShardSuggestResponse(request.shardId(), result);
|
||||||
}
|
}
|
||||||
return new ShardSuggestResponse(request.index(), request.shardId(), new Suggest());
|
return new ShardSuggestResponse(request.shardId(), new Suggest());
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
throw new ElasticsearchException("failed to execute suggest", ex);
|
throw new ElasticsearchException("failed to execute suggest", ex);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -47,10 +47,6 @@ public abstract class BroadcastShardOperationRequest extends TransportRequest im
|
||||||
this.shardId = shardId;
|
this.shardId = shardId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String index() {
|
|
||||||
return this.shardId.getIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] indices() {
|
public String[] indices() {
|
||||||
return new String[]{shardId.getIndex()};
|
return new String[]{shardId.getIndex()};
|
||||||
|
@ -61,8 +57,8 @@ public abstract class BroadcastShardOperationRequest extends TransportRequest im
|
||||||
return IndicesOptions.strictSingleIndexNoExpandForbidClosed();
|
return IndicesOptions.strictSingleIndexNoExpandForbidClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int shardId() {
|
public ShardId shardId() {
|
||||||
return this.shardId.id();
|
return this.shardId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.action.support.broadcast;
|
||||||
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
import org.elasticsearch.index.shard.ShardId;
|
||||||
import org.elasticsearch.transport.TransportResponse;
|
import org.elasticsearch.transport.TransportResponse;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -30,37 +31,33 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public abstract class BroadcastShardOperationResponse extends TransportResponse {
|
public abstract class BroadcastShardOperationResponse extends TransportResponse {
|
||||||
|
|
||||||
String index;
|
ShardId shardId;
|
||||||
int shardId;
|
|
||||||
|
|
||||||
protected BroadcastShardOperationResponse() {
|
protected BroadcastShardOperationResponse() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BroadcastShardOperationResponse(String index, int shardId) {
|
protected BroadcastShardOperationResponse(ShardId shardId) {
|
||||||
this.index = index;
|
|
||||||
this.shardId = shardId;
|
this.shardId = shardId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIndex() {
|
public String getIndex() {
|
||||||
return this.index;
|
return this.shardId.getIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getShardId() {
|
public int getShardId() {
|
||||||
return this.shardId;
|
return this.shardId.id();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
public void readFrom(StreamInput in) throws IOException {
|
||||||
super.readFrom(in);
|
super.readFrom(in);
|
||||||
index = in.readString();
|
shardId = ShardId.readShardId(in);
|
||||||
shardId = in.readVInt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
public void writeTo(StreamOutput out) throws IOException {
|
||||||
super.writeTo(out);
|
super.writeTo(out);
|
||||||
out.writeString(index);
|
shardId.writeTo(out);
|
||||||
out.writeVInt(shardId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -170,22 +170,22 @@ public class PercolatorService extends AbstractComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PercolateShardResponse percolate(PercolateShardRequest request) {
|
public PercolateShardResponse percolate(PercolateShardRequest request) {
|
||||||
IndexService percolateIndexService = indicesService.indexServiceSafe(request.index());
|
IndexService percolateIndexService = indicesService.indexServiceSafe(request.shardId().getIndex());
|
||||||
IndexShard indexShard = percolateIndexService.shardSafe(request.shardId());
|
IndexShard indexShard = percolateIndexService.shardSafe(request.shardId().id());
|
||||||
indexShard.readAllowed(); // check if we can read the shard...
|
indexShard.readAllowed(); // check if we can read the shard...
|
||||||
|
|
||||||
ShardPercolateService shardPercolateService = indexShard.shardPercolateService();
|
ShardPercolateService shardPercolateService = indexShard.shardPercolateService();
|
||||||
shardPercolateService.prePercolate();
|
shardPercolateService.prePercolate();
|
||||||
long startTime = System.nanoTime();
|
long startTime = System.nanoTime();
|
||||||
|
|
||||||
SearchShardTarget searchShardTarget = new SearchShardTarget(clusterService.localNode().id(), request.index(), request.shardId());
|
SearchShardTarget searchShardTarget = new SearchShardTarget(clusterService.localNode().id(), request.shardId().getIndex(), request.shardId().id());
|
||||||
final PercolateContext context = new PercolateContext(
|
final PercolateContext context = new PercolateContext(
|
||||||
request, searchShardTarget, indexShard, percolateIndexService, cacheRecycler, pageCacheRecycler, bigArrays, scriptService
|
request, searchShardTarget, indexShard, percolateIndexService, cacheRecycler, pageCacheRecycler, bigArrays, scriptService
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
ParsedDocument parsedDocument = parseRequest(percolateIndexService, request, context);
|
ParsedDocument parsedDocument = parseRequest(percolateIndexService, request, context);
|
||||||
if (context.percolateQueries().isEmpty()) {
|
if (context.percolateQueries().isEmpty()) {
|
||||||
return new PercolateShardResponse(context, request.index(), request.shardId());
|
return new PercolateShardResponse(context, request.shardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.docSource() != null && request.docSource().length() != 0) {
|
if (request.docSource() != null && request.docSource().length() != 0) {
|
||||||
|
@ -280,7 +280,7 @@ public class PercolatorService extends AbstractComponent {
|
||||||
Tuple<DocumentMapper, Boolean> docMapper = mapperService.documentMapperWithAutoCreate(request.documentType());
|
Tuple<DocumentMapper, Boolean> docMapper = mapperService.documentMapperWithAutoCreate(request.documentType());
|
||||||
doc = docMapper.v1().parse(source(parser).type(request.documentType()).flyweight(true)).setMappingsModified(docMapper);
|
doc = docMapper.v1().parse(source(parser).type(request.documentType()).flyweight(true)).setMappingsModified(docMapper);
|
||||||
if (doc.mappingsModified()) {
|
if (doc.mappingsModified()) {
|
||||||
mappingUpdatedAction.updateMappingOnMaster(request.index(), docMapper.v1(), documentIndexService.indexUUID());
|
mappingUpdatedAction.updateMappingOnMaster(request.shardId().getIndex(), docMapper.v1(), documentIndexService.indexUUID());
|
||||||
}
|
}
|
||||||
// the document parsing exists the "doc" object, so we need to set the new current field.
|
// the document parsing exists the "doc" object, so we need to set the new current field.
|
||||||
currentFieldName = parser.currentName();
|
currentFieldName = parser.currentName();
|
||||||
|
@ -409,7 +409,7 @@ public class PercolatorService extends AbstractComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
cache.close();;
|
cache.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PercolatorType {
|
interface PercolatorType {
|
||||||
|
@ -463,7 +463,7 @@ public class PercolatorService extends AbstractComponent {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PercolateShardResponse(count, context, request.index(), request.shardId());
|
return new PercolateShardResponse(count, context, request.shardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -493,7 +493,7 @@ public class PercolatorService extends AbstractComponent {
|
||||||
} finally {
|
} finally {
|
||||||
percolatorSearcher.close();
|
percolatorSearcher.close();
|
||||||
}
|
}
|
||||||
return new PercolateShardResponse(count, context, request.index(), request.shardId());
|
return new PercolateShardResponse(count, context, request.shardId());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -573,7 +573,7 @@ public class PercolatorService extends AbstractComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
BytesRef[] finalMatches = matches.toArray(new BytesRef[matches.size()]);
|
BytesRef[] finalMatches = matches.toArray(new BytesRef[matches.size()]);
|
||||||
return new PercolateShardResponse(finalMatches, hls, count, context, request.index(), request.shardId());
|
return new PercolateShardResponse(finalMatches, hls, count, context, request.shardId());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ public class PercolatorService extends AbstractComponent {
|
||||||
long count = match.counter();
|
long count = match.counter();
|
||||||
|
|
||||||
BytesRef[] finalMatches = matches.toArray(new BytesRef[matches.size()]);
|
BytesRef[] finalMatches = matches.toArray(new BytesRef[matches.size()]);
|
||||||
return new PercolateShardResponse(finalMatches, hls, count, context, request.index(), request.shardId());
|
return new PercolateShardResponse(finalMatches, hls, count, context, request.shardId());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("failed to execute", e);
|
logger.debug("failed to execute", e);
|
||||||
throw new PercolateException(context.indexShard().shardId(), "failed to execute", e);
|
throw new PercolateException(context.indexShard().shardId(), "failed to execute", e);
|
||||||
|
@ -634,7 +634,7 @@ public class PercolatorService extends AbstractComponent {
|
||||||
long count = matchAndScore.counter();
|
long count = matchAndScore.counter();
|
||||||
|
|
||||||
BytesRef[] finalMatches = matches.toArray(new BytesRef[matches.size()]);
|
BytesRef[] finalMatches = matches.toArray(new BytesRef[matches.size()]);
|
||||||
return new PercolateShardResponse(finalMatches, hls, count, scores, context, request.index(), request.shardId());
|
return new PercolateShardResponse(finalMatches, hls, count, scores, context, request.shardId());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("failed to execute", e);
|
logger.debug("failed to execute", e);
|
||||||
throw new PercolateException(context.indexShard().shardId(), "failed to execute", e);
|
throw new PercolateException(context.indexShard().shardId(), "failed to execute", e);
|
||||||
|
@ -774,9 +774,9 @@ public class PercolatorService extends AbstractComponent {
|
||||||
scores[i++] = scoreDoc.score;
|
scores[i++] = scoreDoc.score;
|
||||||
}
|
}
|
||||||
if (hls != null) {
|
if (hls != null) {
|
||||||
return new PercolateShardResponse(matches.toArray(new BytesRef[matches.size()]), hls, count, scores, context, request.index(), request.shardId());
|
return new PercolateShardResponse(matches.toArray(new BytesRef[matches.size()]), hls, count, scores, context, request.shardId());
|
||||||
} else {
|
} else {
|
||||||
return new PercolateShardResponse(matches.toArray(new BytesRef[matches.size()]), count, scores, context, request.index(), request.shardId());
|
return new PercolateShardResponse(matches.toArray(new BytesRef[matches.size()]), count, scores, context, request.shardId());
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("failed to execute", e);
|
logger.debug("failed to execute", e);
|
||||||
|
|
Loading…
Reference in New Issue