Is there a way to search by already indexed document?

It is a pretty common use case. Let’s say I have a collection of oil paintings. Each one has been indexed already. When user opens one painting, I want to find out similar paintings that might be of interest for the user. Since the current one has already been indexed, it is a waste to resubmit the image url for downloading and preprocessing, as per the api in documentation:

results = mq.index("my-multimodal-index").search('https://upload.wikimedia.org/wikipedia/commons/thumb/9/96/Standing_Hippopotamus_MET_DP248993.jpg/1920px-Standing_Hippopotamus_MET_DP248993.jpg')

Is there an api to search by already indexed entries to find out similar ones?

Thanks.

Hi, searching directly with an already indexed document is not yet supported. However, you could do it another way which is to get the document and its vector and then search using that vector as context.
https://marqo.pages.dev/0.0.18/API-Reference/search/#context
https://marqo.pages.dev/0.0.18/API-Reference/documents/#get-one-document

document = mq.index("my-first-index").get_document("<document_id>", expose_facets=True)

vector = document['_tensor_facets'][0]['_embedding']

results = mq.index("my-first-index").search(
    {"" :0},
    context = {"tensor": [{"vector": vector, "weight" : 1}]}
)