---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
---
Grok pattern with two named fields:
- do:
    text_structure.test_grok_pattern:
      body:
        grok_pattern: "%{WORD}.*%{WORD:first_name} %{WORD:last_name}!"
        text:
        - "Hello   Dave Roberts!"
        - "this does not match"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    matches:
    - matched: true
      fields:
        first_name:
        - match: "Dave"
          offset: 8
          length: 4
        last_name:
        - match: "Roberts"
          offset: 13
          length: 7
    - matched: false
---
Grok pattern with two identically named fields:
- do:
    text_structure.test_grok_pattern:
      ecs_compatibility: "v1"
      body:
        grok_pattern: "%{WORD}.*%{WORD:name} %{WORD:name}!"
        text:
        - "Hello   Dave Roberts!"
        - "this does not match"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- match:
    matches:
    - matched: true
      fields:
        name:
        - match: "Dave"
          offset: 8
          length: 4
        - match: "Roberts"
          offset: 13
          length: 7
    - matched: false
