Error: BadRequestError(400, 'parsing_exception', 'Unknown key for a START_OBJECT in [knn].')

I am not able to figure to this issue
response = es.search(index="cv_resume_dense",query= {
"match": {
"work_experience": {
"query": query,
"boost": 0.9
},
},
},
knn= {
"field": "vector_skills",
"query_vector": query_vector,
"k": 5,
"num_candidates": 50,
"boost": 0.1
},
size= 10)

If you're using >= 8.12, try using knn as a query rather than a top level argument. Here's an example of how you can achieve this type of hybrid search using a boolean query.

Also this python notebook might help. Double check the version of your client. I suspect your version of your client isn't 8.x.

Search elasticsearch-labs/notebooks/search/00-quick-start.ipynb at main · elastic/elasticsearch-labs · GitHub

Hybrid elasticsearch-labs/notebooks/search/02-hybrid-search.ipynb at main · elastic/elasticsearch-labs · GitHub

Joe

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.