---
"Create data stream":
  - skip:
      version: " - 7.6.99"
      reason: available only in 7.7+

  - do:
      indices.create_data_stream:
        name: simple-data-stream1
        body:
          timestamp_field: "@timestamp"
  - is_true: acknowledged

  - do:
      indices.create_data_stream:
        name: simple-data-stream2
        body:
          timestamp_field: "@timestamp2"
  - is_true: acknowledged

  - do:
      indices.get_data_streams: {}
  - match: { 0.name: simple-data-stream1 }
  - match: { 0.timestamp_field: '@timestamp' }
  - match: { 0.indices: [] }
  - match: { 1.name: simple-data-stream2 }
  - match: { 1.timestamp_field: '@timestamp2' }
  - match: { 1.indices: [] }

  - do:
      indices.delete_data_stream:
        name: simple-data-stream2
  - is_true: acknowledged

---
"Create data stream":
  - skip:
      version: " - 7.6.99"
      reason: available only in 7.7+

  - do:
      indices.create_data_stream:
        name: simple-data-stream1
        body:
          timestamp_field: "@timestamp"
  - is_true: acknowledged

  - do:
      indices.create_data_stream:
        name: simple-data-stream2
        body:
          timestamp_field: "@timestamp2"
  - is_true: acknowledged

  - do:
      indices.get_data_streams: {}
  - match: { 0.name: simple-data-stream1 }
  - match: { 0.timestamp_field: '@timestamp' }
  - match: { 0.indices: [] }
  - match: { 1.name: simple-data-stream2 }
  - match: { 1.timestamp_field: '@timestamp2' }
  - match: { 1.indices: [] }

  - do:
      indices.delete_data_stream:
        name: simple-data-stream2
  - is_true: acknowledged

---
"Create data stream with invalid name":
  - skip:
      version: " - 7.7.99"
      reason: available only in 7.8+

  - do:
      catch: bad_request
      indices.create_data_stream:
        name: invalid-data-stream#-name
        body:
          timestamp_field: "@timestamp"

  - match: { status: 400 }
  - match: { error.root_cause.0.type: "illegal_argument_exception" }

Test to enforce response to invalid data stream names
Test to enforce response to invalid data stream names

