Search points by payload's nested objects in Qdrant

1.9k Views Asked by At

I know it is possible to search a Qdrant collection by payload using filters.

For instance this /scroll point query

{
    "filter": {
        "must": [
            {
                "key": "page_content",
                "match": {
                    "text": "days,  "
                }
            }
        ]
    },
    "limit": 1,
    "with_payload": true,
    "with_vector": false
}

returns the result:

{
  "result": {
    "points": [
      {
        "id": "0024d2b5-b4db-4700-adbf-a23a6589789f",
        "payload": {
          "metadata": {
            "name": "test-test"
          },
          "page_content": "Though they don’t realize it when they are in their battles, the hero’s biggest\nreward  is  what  Campbell  calls  the  “boon,”  which  is  the  special  knowledge\nabout how to succeed that the hero has earned through his journey."
        },
        "vector": null
      }
    ],
    "next_page_offset": "0030eb00-7848-4440-85cc-086589775695"
  },
  "status": "ok",
  "time": 0.000294958
}

But I don't understand how to craft a query if I were to search the payload.metadata.name attribute of such Point.

How should I proceed?

Note that my constraint in this app is not being allowed to add more direct members to the payload object. I can only write into the metadata payload attribute.

1

There are 1 best solutions below

0
On BEST ANSWER

I have the same requirement (not surprising since this is the payload structure that LangChain produces). It turns out that simply specifying the "dotted" name of the property (ala Mongo) works. In this example, to query for values of "name" in the "metadata" document you would use the key "metadata.name" in the Qdrant filter.

BTW -- the clue for this was in the code in this LangChain PR -- https://github.com/hwchase17/langchain/pull/5446/files). I confirmed it using the Qdrant REST API.

Quick update -- this is now in the QDrant docs.