Elasticsearch duplicate documents multi fields search error

This search of duplicate documents for single field is working.

curl -XGET 'http://ip:9200/test_4/test_4/_search?pretty=true' -H 'Content-Type: application/json' -d'{
  "size": 0,
  "aggs": {
    "duplicateCount": {
      "terms": {
      "field": "date.keyword",
        "min_doc_count": 2
      },
      "aggs": {
        "duplicateDocuments": {
          "top_hits": {}
        }
      }
    }
  }
}'

This search of duplicate documents for multi fields is not working.

curl -XGET 'http://ip:9200/test_4/test_4/_search?pretty=true' -H 'Content-Type: application/json' -d'{
  "size": 0,
  "aggs": {
    "duplicateCount": {
      "terms": {
      "script": "doc['date'].values + doc['EventType'].values",
        "min_doc_count": 2
      },
      "aggs": {
        "duplicateDocuments": {
          "top_hits": {}
        }
      }
    }
  }
}'

{
  "error" : {
    "root_cause" : [
      {
        "type" : "script_exception",
        "reason" : "compile error",
        "script_stack" : [
          "doc[date].values + doc[EventT ...",
          "    ^---- HERE"
        ],
        "script" : "doc[date].values + doc[EventType].values",
        "lang" : "painless"
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "test_4",
        "node" : "dhB-H0_yRROhoP6W-FhOyA",
        "reason" : {
          "type" : "script_exception",
          "reason" : "compile error",
          "script_stack" : [
            "doc[date].values + doc[EventT ...",
            "    ^---- HERE"
          ],
          "script" : "doc[date].values + doc[EventType].values",
          "lang" : "painless",
          "caused_by" : {
            "type" : "illegal_argument_exception",
            "reason" : "Variable [date] is not defined."
          }
        }
      }
    ]
  },
  "status" : 500
}

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