@@ -170,21 +170,27 @@ public void setup() throws Exception {
170
170
+ " \" properties\" : {\n "
171
171
+ " \" diary_embedding_size\" : {\n "
172
172
+ " \" type\" : \" keyword\" \n "
173
+ + " },\n "
174
+ + " \" diary_embedding_size_int\" : {\n "
175
+ + " \" type\" : \" integer\" \n "
173
176
+ " }\n "
174
177
+ " }\n "
175
178
+ " }\n "
176
179
+ "}" ;
180
+
177
181
String uploadDocumentRequestBodyDoc1 = "{\n "
178
182
+ " \" id\" : 1,\n "
179
183
+ " \" diary\" : [\" happy\" ,\" first day at school\" ],\n "
180
184
+ " \" diary_embedding_size\" : \" 1536\" ,\n " // embedding size for ada model
185
+ + " \" diary_embedding_size_int\" : 1536,\n "
181
186
+ " \" weather\" : \" rainy\" \n "
182
187
+ " }" ;
183
188
184
189
String uploadDocumentRequestBodyDoc2 = "{\n "
185
190
+ " \" id\" : 2,\n "
186
191
+ " \" diary\" : [\" bored\" ,\" at home\" ],\n "
187
192
+ " \" diary_embedding_size\" : \" 768\" ,\n " // embedding size for local text embedding model
193
+ + " \" diary_embedding_size_int\" : 768,\n "
188
194
+ " \" weather\" : \" sunny\" \n "
189
195
+ " }" ;
190
196
@@ -389,7 +395,7 @@ public void testMLInferenceProcessorRemoteModelOptionalInputs() throws Exception
389
395
+ " \" model_id\" : \" "
390
396
+ this .bedrockMultiModalEmbeddingModelId
391
397
+ "\" ,\n "
392
- + " \" query_template\" : \" {\\ \" size\\ \" : 2,\\ \" query\\ \" : {\\ \" range\\ \" : {\\ \" diary_embedding_size \\ \" : {\\ \" gte\\ \" : ${modelPrediction}}}}}\" ,\n "
398
+ + " \" query_template\" : \" {\\ \" size\\ \" : 2,\\ \" query\\ \" : {\\ \" range\\ \" : {\\ \" diary_embedding_size_int \\ \" : {\\ \" gte\\ \" : ${modelPrediction}}}}}\" ,\n "
393
399
+ " \" optional_input_map\" : [\n "
394
400
+ " {\n "
395
401
+ " \" inputText\" : \" query.term.diary.value\" ,\n "
@@ -415,9 +421,8 @@ public void testMLInferenceProcessorRemoteModelOptionalInputs() throws Exception
415
421
createSearchPipelineProcessor (createPipelineRequestBody , pipelineName );
416
422
417
423
Map response = searchWithPipeline (client (), index_name , pipelineName , query );
418
-
419
424
assertEquals ((int ) JsonPath .parse (response ).read ("$.hits.hits.length()" ), 1 );
420
- Assert . assertEquals (JsonPath .parse (response ).read ("$.hits.hits[0]._source.diary_embedding_size " ), " 1536" );
425
+ assertEquals (( double ) JsonPath .parse (response ).read ("$.hits.hits[0]._source.diary_embedding_size_int " ), 1536.0 , 0.0001 );
421
426
}
422
427
423
428
/**
0 commit comments