Java Code Examples for org.elasticsearch.cluster.routing.ShardRouting#index()

The following examples show how to use org.elasticsearch.cluster.routing.ShardRouting#index() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PriorityComparator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public final int compare(ShardRouting o1, ShardRouting o2) {
    final String o1Index = o1.index();
    final String o2Index = o2.index();
    int cmp = 0;
    if (o1Index.equals(o2Index) == false) {
        final Settings settingsO1 = getIndexSettings(o1Index);
        final Settings settingsO2 = getIndexSettings(o2Index);
        cmp = Long.compare(priority(settingsO2), priority(settingsO1));
        if (cmp == 0) {
            cmp = Long.compare(timeCreated(settingsO2), timeCreated(settingsO1));
            if (cmp == 0) {
                cmp = o2Index.compareTo(o1Index);
            }
        }
    }
    return cmp;
}
 
Example 2
Source File: BalancedShardsAllocator.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public void addShard(ShardRouting shard, Decision decision) {
    ModelIndex index = indices.get(shard.index());
    if (index == null) {
        index = new ModelIndex(shard.index());
        indices.put(index.getIndexId(), index);
    }
    index.addShard(shard, decision);
    numShards++;
}
 
Example 3
Source File: AbstractTransportSearchIntoAction.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected ShardSearchIntoRequest newShardRequest(ShardRouting shard,
        SearchIntoRequest request) {
    String[] filteringAliases = clusterService.state().metaData()
            .filteringAliases(shard.index(), request.indices());
    return new ShardSearchIntoRequest(shard.index(), shard.id(),
            filteringAliases, request);
}
 
Example 4
Source File: AbstractTransportExportAction.java    From elasticsearch-inout-plugin with Apache License 2.0 4 votes vote down vote up
@Override
protected ShardExportRequest newShardRequest(ShardRouting shard, ExportRequest request) {
    String[] filteringAliases = clusterService.state().metaData().filteringAliases(shard.index(), request.indices());
    return new ShardExportRequest(shard.index(), shard.id(), filteringAliases, request);
}