How to access input field value in script in elasticsearch

I'm using bool query and I want to use matched result value in a script in elastic search

  {
"query": {
"nested": {
  "path": "Names",
  "query": {
    "function_score": {
      "script_score": {
        "script": {
          "source": "((_score)/(X+doc['Names.count'].value))*100"
        }
      },
      "min_score": 80,
      "query": {
        "bool": {
          "should": [
            {
              "match": {
                "Names.name": "siriporn kanchana"
              }
            },
            {
              "match": {
                "Names.name": "ganjana siriporn"
              }
            }
          ]
        }
      }
    }
  }
}
} }
in above I want X value should be the length of matched string example if sirporn is matched then I want x= 7.is it possible in elasticsearch

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