The following error message emitted from org.elasticsearch.action.support.replication.ReplicationOperation is misleading:

```
Not enough active copies to meet shard count of [1] (have 1, needed 1)
```

full context:
```
org.elasticsearch.transport.RemoteTransportException: [es-es-index-58f985f8f-pgls6][10.2.12.197:9300][indices:data/write/bulk[s][p]]
Caused by: org.elasticsearch.action.UnavailableShardsException: [.security-7][0] Not enough active copies to meet shard count of [1] (have 1, needed 1). Timeout: [1m], request: [BulkShardRequest [[.security-7][0]] containing [index {[.security][myrole], source[{"enabled":true,"roles":["myrole"],"rules":{"all":[{"field":{"realm.name":"myrealm"}},{"field":{"username":"me"}}]},"metadata":{},"doc_type":"role-mapping"}]}] and a refresh]
```

The message appears to be due to the calculation for wait_for_active_shards only counts search shards, but the message is constructed by counting all shards. In stateless this message can mean that the search shard is not available. 



server/src/main/java/org/elasticsearch/action/support/ActiveShardCount.java
private static final int ALL_ACTIVE_SHARDS = -1;
    public static final ActiveShardCount DEFAULT = new ActiveShardCount(ACTIVE_SHARD_COUNT_DEFAULT);
    public static final ActiveShardCount ALL = new ActiveShardCount(ALL_ACTIVE_SHARDS);
    public static final ActiveShardCount NONE = new ActiveShardCount(0);
    public static final ActiveShardCount ONE = new ActiveShardCount(1);
    /**
     * Get an ActiveShardCount instance for the given value.  The value is first validated to ensure
     * it is a valid shard count and throws an IllegalArgumentException if validation fails.  Valid
     * values are any non-negative number.  Directly use {@link ActiveShardCount#DEFAULT} for the
     * default value (which is one shard copy) or {@link ActiveShardCount#ALL} to specify all the shards.
     */
    public static ActiveShardCount from(final int value) {
        if (value < 0) {
            throw new IllegalArgumentException("shard count cannot be a negative value");
        }
        return get(value);
    }
    /**
     * Validates that the instance is valid for the given number of replicas in an index.
     */
    public boolean validate(final int numberOfReplicas) {
        assert numberOfReplicas >= 0;
        return value <= numberOfReplicas + 1;
    }
    private static ActiveShardCount get(final int value) {
        switch (value) {
            case ACTIVE_SHARD_COUNT_DEFAULT:
                return DEFAULT;
            case ALL_ACTIVE_SHARDS:
                return ALL;