---
teardown:
  - do:
      ingest.delete_pipeline:
        id: "my_pipeline"
        ignore: 404

---
"Test set document version & version type":
  - do:
      cluster.health:
          wait_for_status: green

  - do:
      ingest.put_pipeline:
        id: "my_pipeline1"
        body:  >
          {
            "description": "_description",
            "processors": [
              {
                "set" : {
                  "field" : "_version",
                  "value": 1
                }
              },
              {
                "set" : {
                  "field" : "_version_type",
                  "value": "internal"
                }
              }
            ]
          }
  - match: { acknowledged: true }

  - do:
      ingest.put_pipeline:
        id: "my_pipeline2"
        body:  >
          {
            "description": "_description",
            "processors": [
              {
                "set" : {
                  "field" : "_version",
                  "value": 1
                }
              },
              {
                "set" : {
                  "field" : "_version_type",
                  "value": "external"
                }
              }
            ]
          }
  - match: { acknowledged: true }

  - do:
      catch: conflict
      index:
        index: test
        id: "1"
        pipeline: "my_pipeline1"
        body: {}

  - do:
      index:
        index: test
        id: "1"
        pipeline: "my_pipeline2"
        body: {}
  - match: { _version: 1 }
