88use DirectoryTree \OpenSearchAdapter \Indices \Mapping ;
99use DirectoryTree \OpenSearchAdapter \Indices \Settings ;
1010use DirectoryTree \OpenSearchMigrations \IndexManagerInterface ;
11-
12- use function DirectoryTree \OpenSearchMigrations \prefix_alias_name ;
13- use function DirectoryTree \OpenSearchMigrations \prefix_index_name ;
11+ use DirectoryTree \OpenSearchMigrations \Support \Prefix ;
1412
1513/**
1614 * Adapts the OpenSearch index manager for migration-friendly operations.
@@ -29,7 +27,7 @@ public function __construct(
2927 */
3028 public function create (string $ index , ?callable $ modifier = null ): IndexManagerInterface
3129 {
32- $ prefixedIndex = prefix_index_name ($ index );
30+ $ prefixedIndex = Prefix:: index ($ index );
3331
3432 if (isset ($ modifier )) {
3533 $ mapping = new Mapping ;
@@ -52,7 +50,7 @@ public function create(string $index, ?callable $modifier = null): IndexManagerI
5250 */
5351 public function createIfNotExists (string $ index , ?callable $ modifier = null ): IndexManagerInterface
5452 {
55- $ prefixedIndex = prefix_index_name ($ index );
53+ $ prefixedIndex = Prefix:: index ($ index );
5654
5755 if (! $ this ->indexManager ->exists ($ prefixedIndex )) {
5856 $ this ->create ($ index , $ modifier );
@@ -66,7 +64,7 @@ public function createIfNotExists(string $index, ?callable $modifier = null): In
6664 */
6765 public function putMapping (string $ index , callable $ modifier ): IndexManagerInterface
6866 {
69- $ prefixedIndex = prefix_index_name ($ index );
67+ $ prefixedIndex = Prefix:: index ($ index );
7068
7169 $ mapping = new Mapping ;
7270 $ modifier ($ mapping );
@@ -81,7 +79,7 @@ public function putMapping(string $index, callable $modifier): IndexManagerInter
8179 */
8280 public function putSettings (string $ index , callable $ modifier ): IndexManagerInterface
8381 {
84- $ prefixedIndex = prefix_index_name ($ index );
82+ $ prefixedIndex = Prefix:: index ($ index );
8583
8684 $ settings = new Settings ;
8785 $ modifier ($ settings );
@@ -96,7 +94,7 @@ public function putSettings(string $index, callable $modifier): IndexManagerInte
9694 */
9795 public function pushSettings (string $ index , callable $ modifier ): IndexManagerInterface
9896 {
99- $ prefixedIndex = prefix_index_name ($ index );
97+ $ prefixedIndex = Prefix:: index ($ index );
10098
10199 $ this ->indexManager ->close ($ prefixedIndex );
102100 $ this ->putSettings ($ index , $ modifier );
@@ -110,7 +108,7 @@ public function pushSettings(string $index, callable $modifier): IndexManagerInt
110108 */
111109 public function drop (string $ index ): IndexManagerInterface
112110 {
113- $ prefixedIndex = prefix_index_name ($ index );
111+ $ prefixedIndex = Prefix:: index ($ index );
114112
115113 $ this ->indexManager ->delete ($ prefixedIndex );
116114
@@ -122,7 +120,7 @@ public function drop(string $index): IndexManagerInterface
122120 */
123121 public function dropIfExists (string $ index ): IndexManagerInterface
124122 {
125- $ prefixedIndex = prefix_index_name ($ index );
123+ $ prefixedIndex = Prefix:: index ($ index );
126124
127125 if ($ this ->indexManager ->exists ($ prefixedIndex )) {
128126 $ this ->drop ($ index );
@@ -138,8 +136,8 @@ public function dropIfExists(string $index): IndexManagerInterface
138136 */
139137 public function putAlias (string $ index , string $ aliasName , ?array $ filter = null ): IndexManagerInterface
140138 {
141- $ prefixedIndex = prefix_index_name ($ index );
142- $ prefixedAliasName = prefix_alias_name ($ aliasName );
139+ $ prefixedIndex = Prefix:: index ($ index );
140+ $ prefixedAliasName = Prefix:: alias ($ aliasName );
143141
144142 $ this ->indexManager ->putAlias ($ prefixedIndex , new Alias ($ prefixedAliasName , $ filter ));
145143
@@ -151,8 +149,8 @@ public function putAlias(string $index, string $aliasName, ?array $filter = null
151149 */
152150 public function deleteAlias (string $ index , string $ aliasName ): IndexManagerInterface
153151 {
154- $ prefixedIndex = prefix_index_name ($ index );
155- $ prefixedAliasName = prefix_alias_name ($ aliasName );
152+ $ prefixedIndex = Prefix:: index ($ index );
153+ $ prefixedAliasName = Prefix:: alias ($ aliasName );
156154
157155 $ this ->indexManager ->deleteAlias ($ prefixedIndex , $ prefixedAliasName );
158156
0 commit comments