Below is my payload but it works only when query_body is empty. I couldn’t figure out whats wrong inside it. I have a Docker container for the MCP server and it throws Bad Request every time.
payload = {
"jsonrpc": "2.0",
"id": 11,
"method": "tools/call",
"params": {
"name": "search",
"arguments": {
"index": "chunking_test",
"query_body": {
"size": 10,
"query": {
"bool": {
"must_not": [{"term": {"type.keyword": {"value": "Image"}}}]
}
},
"knn": {
"field": "embedding",
"query_vector": query_vector,
"k": k,
"num_candidates": k*10
}
}
}
}
}
Hello @tarun-ghcp
Welcome to the Community!!
Could you please check once below line :
"must_not": [{"term": {"type.keyword": {"value": "Image"}}}]
I am not sure if we need to use value in the query as per the documentation
"bool": {
"must_not": [
{ "term": { "type.keyword": "Image" } }
]
}
Thanks!!
This is my updated payload. But still same issue that if not keeping anything inside query_body, it gives me the result….
payload = {
"jsonrpc": "2.0",
"id": 11,
"method": "tools/call",
"params": {
"name": "search",
"arguments": {
"index": "chunking_test",
"query_body": {
"knn": {
"field": "embedding",
"query_vector": query_vector,
"k": k,
"num_candidates": k*10
},
"query": {
"fields": ["text.document.documentTitle", "text.document.fileName"],
"must_not": [
{"term": {"type.keyword": {"value": "Image"}}}
]
},
"size":10
}
}
}
}