**Build scan:**
https://gradle-enterprise.elastic.co/s/nmjznurkclizw/tests/:x-pack:plugin:security:internalClusterTest/org.elasticsearch.xpack.security.profile.ProfileDomainIntegTests/testConcurrentCreationOfNewProfiles

**Reproduction line:**
`./gradlew ':x-pack:plugin:security:internalClusterTest' --tests "org.elasticsearch.xpack.security.profile.ProfileDomainIntegTests.testConcurrentCreationOfNewProfiles" -Dtests.seed=DF7A58E7374EF2C7 -Dtests.locale=id-ID -Dtests.timezone=Europe/Ljubljana -Druntime.java=17`

**Applicable branches:**
master

**Reproduces locally?:**
No

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.xpack.security.profile.ProfileDomainIntegTests&tests.test=testConcurrentCreationOfNewProfiles

**Failure excerpt:**
```
com.carrotsearch.randomizedtesting.UncaughtExceptionError: Captured an uncaught exception in thread: Thread[id=339, name=Thread-17, state=RUNNABLE, group=TGRP-ProfileDomainIntegTests]


  Caused by: java.lang.AssertionError: caught error when creating new profile: org.elasticsearch.action.UnavailableShardsException: at least one primary shard for the index [.security-profile-8] is unavailable

    at __randomizedtesting.SeedInfo.seed([DF7A58E7374EF2C7]:0)
    at org.junit.Assert.fail(Assert.java:88)
    at org.elasticsearch.xpack.security.profile.ProfileDomainIntegTests.lambda$testConcurrentCreationOfNewProfiles$0(ProfileDomainIntegTests.java:321)
    at java.lang.Thread.run(Thread.java:833)

```
x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/profile/ProfileDomainIntegTests.java
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0; you may not use this file except in compliance with the Elastic License
 * 2.0.
 */
package org.elasticsearch.xpack.security.profile;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.engine.VersionConflictEngineException;
import org.elasticsearch.xcontent.XContentType;
import org.elasticsearch.xpack.core.security.action.profile.Profile;
import org.elasticsearch.xpack.core.security.action.user.PutUserAction;
import org.elasticsearch.xpack.core.security.action.user.PutUserRequest;