Multiple filters in knnBeta $search

You should be able to put a compound within the knnBeta.filter field.

Here is an example:

      "query": {
        "knnBeta": {
          "path": "description",
          "k": 10,
          "vector": [
            8,
            8,
            8
          ],
          "filter": {
            "compound": {
              "mustNot": {
                "text": {
                  "path": "title",
                  "query": "world"
                }
              },
              "must": [
                {
                  "text": {
                    "path": "title",
                    "query": "hello"
                  }
                }
              ]
            }
          }
        }
      },
2 Likes