Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
2.17 AWS OS
Describe the issue:
I’d like to add query search term as input in the ml_inference processor. I followed the example here: ML inference (response) - OpenSearch Documentation
My processor is as follows:
PUT /_search/pipeline/my_pipeline_request_review_llm
{
"response_processors": [
{
"ml_inference": {
"tag": "ml_inference",
"description": "This processor is going to run llm",
"model_id": "GzeEVZMB-kzw4OgFUNaB",
"function_name": "REMOTE",
"input_map": [
{
"context": "title",
"question": "$._request.query.term.title.value"
}
],
"output_map": [
{
"ext.ml_inference.llm_response": "generated_text"
}
],
"model_config": {
"prompt": "Based on following context: ${parameters.context.toString()}. Answer the question: ${parameters.question.toString()} ?"
},
"ignore_missing": false,
"ignore_failure": false
}
}
]
}
Running search:
GET test_tech_news2/_search?search_pipeline=my_pipeline_request_review_llm
{
"_source": ["title"],
"query": {
"term": {
"title": {
"value": "Sample Document"
}
}
}
}
I get the following response:
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "cannot find all required input fields: [title, $._request.query.term.title.value] in hit:{\n \"_index\" : \"test_tech_news2\",\n \"_id\" : \"K8PXopMBNsmyby02l4zY\",\n \"_score\" : 0.2876821,\n \"_source\" : {\n \"title\" : \"Sample Document\"\n }\n}"
}
],
"type": "illegal_argument_exception",
"reason": "cannot find all required input fields: [title, $._request.query.term.title.value] in hit:{\n \"_index\" : \"test_tech_news2\",\n \"_id\" : \"K8PXopMBNsmyby02l4zY\",\n \"_score\" : 0.2876821,\n \"_source\" : {\n \"title\" : \"Sample Document\"\n }\n}"
},
"status": 400
}
For some reason it’s not letting me use $._request.query.term.title.value
here. I tried a few workaround but none have worked so far.
Please help
Configuration:
Relevant Logs or Screenshots: