This is the csv containing the _score and _explanation for the hits.
_score,_explanation
1.6622047,"{'value': 1.6622047, 'description': 'sum of:', 'details': [{'value': 0.66220474, 'description': 'within top k documents', 'details': []}, {'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
1.6613073,"{'value': 1.6613073, 'description': 'sum of:', 'details': [{'value': 0.6613073, 'description': 'within top k documents', 'details': []}, {'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
1.6607261,"{'value': 1.6607261, 'description': 'sum of:', 'details': [{'value': 0.660726, 'description': 'within top k documents', 'details': []}, {'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
1.6599699,"{'value': 1.6599699, 'description': 'sum of:', 'details': [{'value': 0.6599699, 'description': 'within top k documents', 'details': []}, {'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
1.6598208,"{'value': 1.6598208, 'description': 'sum of:', 'details': [{'value': 0.65982085, 'description': 'within top k documents', 'details': []}, {'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
1.0,"{'value': 1.0, 'description': 'sum of:', 'details': [{'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
1.0,"{'value': 1.0, 'description': 'sum of:', 'details': [{'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
1.0,"{'value': 1.0, 'description': 'sum of:', 'details': [{'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
1.0,"{'value': 1.0, 'description': 'sum of:', 'details': [{'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
1.0,"{'value': 1.0, 'description': 'sum of:', 'details': [{'value': 1.0, 'description': 'ConstantScore(*:*)', 'details': []}]}"
This is the src for the search in Python:
text = "lion"
text_embed = encode_text(text)
query_vector = text_embed.tolist()
k = 10
resp = es.search(
index="image-index",
size=k,
request_timeout=30,
query={"constant_score": {"filter": {"match_all": {}}, "boost": 1.0}},
knn={
"field": "image_vector",
"query_vector": query_vector,
"k": k,
"num_candidates": 100,
},
_source=["image_url", "image_desc", "filetype"],
explain=True
)