@@ -52,7 +52,7 @@ public class SemanticCrossClusterSearchIT extends AbstractMultiClustersTestCase
5252 private static final String REMOTE_CLUSTER = "cluster_a" ;
5353 private static final String INFERENCE_FIELD = "inference_field" ;
5454
55- private static final Map <String , Object > BBQ_COMPATIBLE_SERVICE_SETTINGS = Map .of (
55+ private static final Map <String , Object > TEXT_EMBEDDING_SERVICE_SETTINGS_1 = Map .of (
5656 "model" ,
5757 "my_model" ,
5858 "dimensions" ,
@@ -63,6 +63,17 @@ public class SemanticCrossClusterSearchIT extends AbstractMultiClustersTestCase
6363 "my_api_key"
6464 );
6565
66+ private static final Map <String , Object > TEXT_EMBEDDING_SERVICE_SETTINGS_2 = Map .of (
67+ "model" ,
68+ "my_model" ,
69+ "dimensions" ,
70+ 384 ,
71+ "similarity" ,
72+ "cosine" ,
73+ "api_key" ,
74+ "my_api_key"
75+ );
76+
6677 @ Override
6778 protected List <String > remoteClusterAlias () {
6879 return List .of (REMOTE_CLUSTER );
@@ -142,9 +153,15 @@ public void testMatchCrossClusterSearch() throws Exception {
142153 }
143154
144155 private Map <String , Object > setupTwoClusters (String [] localIndices , String [] remoteIndices ) throws IOException {
145- final String inferenceId = "test_inference_id" ;
146- createInferenceEndpoint (client (LOCAL_CLUSTER ), TaskType .TEXT_EMBEDDING , inferenceId , BBQ_COMPATIBLE_SERVICE_SETTINGS );
147- createInferenceEndpoint (client (REMOTE_CLUSTER ), TaskType .TEXT_EMBEDDING , inferenceId , BBQ_COMPATIBLE_SERVICE_SETTINGS );
156+ final String localInferenceId = "local_inference_id" ;
157+ final String remoteInferenceId = "remote_inference_id" ;
158+
159+ // TODO: Resolve bug where remote model registry overwrites local model registry in SemanticQueryBuilder
160+ createInferenceEndpoint (client (LOCAL_CLUSTER ), TaskType .TEXT_EMBEDDING , localInferenceId , TEXT_EMBEDDING_SERVICE_SETTINGS_1 );
161+ createInferenceEndpoint (client (LOCAL_CLUSTER ), TaskType .TEXT_EMBEDDING , remoteInferenceId , TEXT_EMBEDDING_SERVICE_SETTINGS_2 );
162+
163+ createInferenceEndpoint (client (REMOTE_CLUSTER ), TaskType .TEXT_EMBEDDING , localInferenceId , TEXT_EMBEDDING_SERVICE_SETTINGS_1 );
164+ createInferenceEndpoint (client (REMOTE_CLUSTER ), TaskType .TEXT_EMBEDDING , remoteInferenceId , TEXT_EMBEDDING_SERVICE_SETTINGS_2 );
148165
149166 int numShardsLocal = randomIntBetween (2 , 10 );
150167 Settings localSettings = indexSettings (numShardsLocal , randomIntBetween (0 , 1 )).build ();
@@ -154,7 +171,7 @@ private Map<String, Object> setupTwoClusters(String[] localIndices, String[] rem
154171 .indices ()
155172 .prepareCreate (localIndex )
156173 .setSettings (localSettings )
157- .setMapping (INFERENCE_FIELD , "type=semantic_text,inference_id=" + inferenceId )
174+ .setMapping (INFERENCE_FIELD , "type=semantic_text,inference_id=" + localInferenceId )
158175 );
159176 indexDocs (client (LOCAL_CLUSTER ), localIndex );
160177 }
@@ -168,7 +185,7 @@ private Map<String, Object> setupTwoClusters(String[] localIndices, String[] rem
168185 .indices ()
169186 .prepareCreate (remoteIndex )
170187 .setSettings (indexSettings (numShardsRemote , randomIntBetween (0 , 1 )))
171- .setMapping (INFERENCE_FIELD , "type=semantic_text,inference_id=" + inferenceId )
188+ .setMapping (INFERENCE_FIELD , "type=semantic_text,inference_id=" + remoteInferenceId )
172189 );
173190 assertFalse (
174191 client (REMOTE_CLUSTER ).admin ()
0 commit comments