Transform doesn't create a destination index

I'm trying to compare data in two indices using a slightly altered version of transform from here

curl -v -H "content-type: application/json" -X PUT http://elastic-cluster:9200/_transform/compare_idx -d '{
  "id" : "compare_idx",
  "source" : { 
    "index" : [
      "index_1",
      "index_2"
    ],
    "query" : {
      "match_all" : { }
    }
  },
  "dest" : { 
    "index" : "compare_indices"
  },
  "pivot" : {
    "group_by" : {
      "unique-id" : {
        "terms" : {
          "field" : "_id" 
        }
      }
    },
    "aggs" : {
	  "count_indices" : {
	    "cardinality": {
        "field": "_index",
        "precision_threshold": 1 
      }
	  },
	  "filter_nulls" : {
	    "bucket_selector" : {
		  "buckets_path" : {
		  "count" : "count_indices"
		  },
		  "script" : "params.count == 1"
		}
	  }
    }
  }
}
'

In the preview mode everything works as expected. However, when I try to create a transform, it's being created fine, but /_cat/_indices doesn't provide me with "compare_indices" index. Documentation says dest index is supposed to be created automatically. Am I doing something wrong?

Hi @knopkosasha !
Your transform config looks fine, but I am wondering - did you start the transform by using the REST API call to the _start endpoint like this

POST _transform/<transform_id>/_start

(see the docs here Start transform API | Elasticsearch Guide [7.16] | Elastic)

After you create the transform config, you also need to start the transform job. This will transform the data according to your config and write it into the destination index.

Oh, thanks! I'm pretty new to transforms through curl (used to work through Kibana). That helped a lot

No worries! Feel free to come back with questions if anything else comes up!

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