How to get nested field value equal to keyword field value

can i get b value in nested script query?

PUT test
{
  "mappings": {
    "properties": {
      "b": {
        "type": "keyword"
      },
      "nested": {
        "type": "nested",
        "properties": {
          "a": {
            "type": "keyword"
          }
        }
      }
    }
  }
}
POST test/_search
{
  "query": {
    "nested": {
      "path": "nested",
      "query": {
        "script": {
          "script": """
              doc['nested.a'].value == doc['b'].value
            """
        }
      }
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.