code: def test_nesting_nested_payload_query_operations():
      response = request_with_validation(
          api="/collections/{collection_name}",
          method="GET",
          path_params={"collection_name": collection_name},
      )
      assert response.ok
  
      # Create nested array index
      response = request_with_validation(
          api="/collections/{collection_name}/index",
          method="PUT",
          path_params={"collection_name": collection_name},
          query_params={"wait": "true"},
          body={
              "field_name": "arr1[].arr2[].a",
              "field_schema": "integer",
          },
      )
      assert response.ok
  
      # Validate index creation
      response = request_with_validation(
          api="/collections/{collection_name}",
          method="GET",
          path_params={"collection_name": collection_name},
      )
      assert response.ok
      assert (
          response.json()["result"]["payload_schema"][
              "arr1[].arr2[].a"
          ]["data_type"]
          == "integer"
      )
      assert (
          response.json()["result"]["payload_schema"][
              "arr1[].arr2[].a"
          ]["points"]
          == 2
      )
  
      # Search nested field with payload index
      response = request_with_validation(
          api="/collections/{collection_name}/points/scroll",
          method="POST",
          path_params={"collection_name": collection_name},
          body={
              "filter": {
                  "must": [
                      {
                          "nested": {
                              "key": "arr1",
                              "filter": {
                                  "must": [
                                      {
                                          "key": "arr2[].a",
                                          "match": {"value": 5},
                                      }
                                  ]
                              },
                          }
                      }
                  ]
              },
              "limit": 3,
          },
      )
      assert response.ok
      assert len(response.json()["result"]["points"]) == 2
  
      # Search nested field with payload index (negative)
      response = request_with_validation(
          api="/collections/{collection_name}/points/scroll",
          method="POST",
          path_params={"collection_name": collection_name},
          body={
              "filter": {
                  "must": [
                      {
                          "nested": {
                              "key": "arr1",
                              "filter": {
                                  "must": [
                                      {
                                          "key": "arr2[].a",
                                          "match": {"value": 4},
                                      }
                                  ]
                              },
                          }
                      }
                  ]
              },
              "limit": 3,
          },
      )
      assert response.ok
      assert len(response.json()["result"]["points"]) == 0
  
      # Search nested field without payload index
      response = request_with_validation(
          api="/collections/{collection_name}/points/scroll",
          method="POST",
          path_params={"collection_name": collection_name},
          body={
              "filter": {
                  "must": [
                      {
                          "nested": {
                              "key": "arr1",
                              "filter": {
                                  "must": [
                                      {
                                          "key": "arr2[].b",
                                          "match": {"value": 6},
                                      }
                                  ]
                              },
                          }
                      }
                  ]
              },
              "limit": 3,
          },
      )
      assert response.ok
      assert len(response.json()["result"]["points"]) == 1
  
      # Search nested field without payload index (negative)
      response = request_with_validation(
          api="/collections/{collection_name}/points/scroll",
          method="POST",
          path_params={"collection_name": collection_name},
          body={
              "filter": {
                  "must": [
                      {
                          "nested": {
                              "key": "arr1[].arr2",
                              "filter": {
                                  "must": [
                                      {
                                          "key": "b",
                                          "match": {"value": 8},
                                      }
                                  ]
                              },
                          }
                      }
                  ]
              },
              "limit": 3,
          },
      )
      assert response.ok
      assert len(response.json()["result"]["points"]) == 0
  
      # Search doubly nested field with payload index
      response = request_with_validation(
          api="/collections/{collection_name}/points/scroll",
          method="POST",
          path_params={"collection_name": collection_name},
          body={
              "filter": {
                  "must": [
                      {
                          "nested": {
                              "key": "arr1",
                              "filter": {
                                  "must": [
                                      {
                                          "nested": {
                                              "key": "arr2",
                                              "filter": {
                                                  "must": [
                                                      {
                                                          "key": "a",
                                                          "match": {
                                                              "value": 5
                                                          },
                                                      }
                                                  ]
                                              },
                                          }
                                      }
                                  ]
                              },
                          }
                      }
                  ]
              },
              "limit": 3,
          },
      )
      assert response.ok
      assert len(response.json()["result"]["points"]) == 2
  
      # Search doubly nested field with and without payload index
      response = request_with_validation(
          api="/collections/{collection_name}/points/scroll",
          method="POST",
          path_params={"collection_name": collection_name},
          body={
              "filter": {
                  "must": [
                      {
                          "nested": {
                              "key": "arr1",
                              "filter": {
                                  "must": [
                                      {
                                          "nested": {
                                              "key": "arr2",
                                              "filter": {
                                                  "must": [
                                                      {
                                                          "key": "a",
                                                          "match": {
                                                              "value": 5
                                                          },
                                                      },
                                                      {
                                                          "key": "b",
                                                          "match": {
                                                              "value": 6
                                                          },
                                                      },
                                                  ]
                                              },
                                          }
                                      }
                                  ]
                              },
                          }
                      }
                  ]
              },
              "limit": 3,
          },
      )
      assert response.ok
      assert len(response.json()["result"]["points"]) == 1
      assert response.json()["result"]["points"][0]["id"] == 1
  
      # Search doubly nested field with and without payload index
      response = request_with_validation(
          api="/collections/{collection_name}/points/scroll",
          method="POST",
          path_params={"collection_name": collection_name},
          body={
              "filter": {
                  "must": [
                      {
                          "nested": {
                              "key": "arr1",
                              "filter": {
                                  "must": [
                                      {
                                          "nested": {
                                              "key": "arr2",
                                              "filter": {
                                                  "should": [
                                                      {
                                                          "key": "a",
                                                          "match": {
                                                              "value": 5
                                                          },
                                                      },
                                                      {
                                                          "key": "b",
                                                          "match": {
                                                              "value": 6
                                                          },
                                                      },
                                                  ]
                                              },
                                          }
                                      }
                                  ]
                              },
                          }
                      }
                  ]
              },
              "limit": 3,
          },
      )
      assert response.ok
      assert len(response.json()["result"]["points"]) == 2
  
imports: import pytest
  from .helpers.collection_setup import drop_collection
  from .helpers.helpers import request_with_validation
label_desc: Use image node_id 3 for calling a global function with example usage: test_nesting_nested_payload_query_operations() without return types