core/src/main/java/org/elasticsearch/indices/IndicesService.java
public boolean canDeleteShardContent(ShardId shardId, IndexSettings indexSettings) {
        assert shardId.getIndex().equals(indexSettings.getIndex());
        final IndexService indexService = this.indices.get(shardId.getIndexName());
        if (indexSettings.isOnSharedFilesystem() == false) {
            if (indexService != null && nodeEnv.hasNodeFile()) {
                return indexService.hasShard(shardId.id()) == false;
            } else if (nodeEnv.hasNodeFile()) {
                if (indexSettings.hasCustomDataPath()) {
                    return Files.exists(nodeEnv.resolveCustomLocation(indexSettings, shardId));
                } else {
                    return FileSystemUtils.exists(nodeEnv.availableShardPaths(shardId));
                }
            }
        } else {
            logger.trace("{} skipping shard directory deletion due to shadow replicas", shardId);
        }
        return false;
    }
/**
     * Returns <code>true</code> iff the shards content for the given shard can be deleted.
     * This method will return <code>false</code> if:
     * <ul>
     *     <li>if the shard is still allocated / active on this node</li>
     *     <li>if for instance if the shard is located on shared and should not be deleted</li>
     *     <li>if the shards data locations do not exists</li>
     * </ul>
     *
     * @param shardId the shard to delete.
     * @param indexSettings the shards's relevant {@link IndexSettings}. This is required to access the indexes settings etc.
     */
Returns true iff the shards content for the given shard can be deleted.
This method will return false if:

if the shard is still allocated / active on this node
if for instance if the shard is located on shared and should not be deleted
if the shards data locations do not exists


@param shardId the shard to delete.
@param indexSettings the shards's relevant  IndexSettings. This is required to access the indexes settings etc.
Returns true iff the shards content for the given shard can be deleted . This method will return false if : if the shard is still allocated / active on this node if for instance if the shard is located on shared and should not be deleted if the shards data locations do not exists @param shardId the shard to delete . @param indexSettings the shards ' s relevant IndexSettings . This is required to access the indexes settings etc .
public boolean canDeleteShardContent(ShardId shardId, IndexSettings indexSettings) {
        assert shardId.getIndex().equals(indexSettings.getIndex());
        final IndexService indexService = this.indices.get(shardId.getIndexName());
        if (indexSettings.isOnSharedFilesystem() == false) {
            if (indexService != null && nodeEnv.hasNodeFile()) {
                return indexService.hasShard(shardId.id()) == false;
            } else if (nodeEnv.hasNodeFile()) {
                if (indexSettings.hasCustomDataPath()) {
                    return Files.exists(nodeEnv.resolveCustomLocation(indexSettings, shardId));
                } else {
                    return FileSystemUtils.exists(nodeEnv.availableShardPaths(shardId));
                }
            }
        } else {
            logger.trace("{} skipping shard directory deletion due to shadow replicas", shardId);
        }
        return false;
    }
public boolean canDeleteShardContent ( ShardId shardId , IndexSettings indexSettings ) { assert shardId . getIndex ( ) . equals ( indexSettings . getIndex ( ) ) ; final IndexService indexService = this . indices . get ( shardId . getIndexName ( ) ) ; if ( indexSettings . isOnSharedFilesystem ( ) == false ) { if ( indexService != null && nodeEnv . hasNodeFile ( ) ) { return indexService . hasShard ( shardId . id ( ) ) == false ; } else if ( nodeEnv . hasNodeFile ( ) ) { if ( indexSettings . hasCustomDataPath ( ) ) { return Files . exists ( nodeEnv . resolveCustomLocation ( indexSettings , shardId ) ) ; } else { return FileSystemUtils . exists ( nodeEnv . availableShardPaths ( shardId ) ) ; } } } else { logger . trace ( "{} skipping shard directory deletion due to shadow replicas" , shardId ) ; } return false ; }
Returns <code>true</code> iff the shards content for the given shard can be deleted.
Returns <code > true< / code > iff the shards content for the given shard can be deleted .