---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
---
Basic test:
- do:
    indices.analyze:
      body:
        text: "Foo Bar"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- length:
    tokens: 2
- match:
    tokens.0.token: "foo"
- match:
    tokens.1.token: "bar"
---
Index and field:
- do:
    indices.create:
      index: "test"
      body:
        mappings:
          properties:
            text:
              type: "text"
              analyzer: "standard"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- do:
    indices.analyze:
      index: "test"
      body:
        field: "text"
        text: "Foo Bar!"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- length:
    tokens: 2
- match:
    tokens.0.token: "foo"
- match:
    tokens.1.token: "bar"
---
Array text:
- do:
    indices.analyze:
      body:
        text:
        - "Foo Bar"
        - "Baz"
        tokenizer: "standard"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- length:
    tokens: 3
- match:
    tokens.0.token: "Foo"
- match:
    tokens.1.token: "Bar"
- match:
    tokens.2.token: "Baz"
---
Detail response with Analyzer:
- do:
    indices.analyze:
      body:
        text: "This is troubled"
        analyzer: "standard"
        explain: true
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- length:
    detail.analyzer.tokens: 3
- match:
    detail.analyzer.name: "standard"
- match:
    detail.analyzer.tokens.0.token: "this"
- match:
    detail.analyzer.tokens.1.token: "is"
- match:
    detail.analyzer.tokens.2.token: "troubled"
---
Custom filter in request:
- do:
    indices.analyze:
      body:
        text: "foo bar buzz"
        tokenizer: "standard"
        explain: true
        filter:
        - type: "stop"
          stopwords:
          - "foo"
          - "buzz"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- length:
    detail.tokenizer.tokens: 3
- length:
    detail.tokenfilters.0.tokens: 1
- match:
    detail.tokenizer.name: "standard"
- match:
    detail.tokenizer.tokens.0.token: "foo"
- match:
    detail.tokenizer.tokens.1.token: "bar"
- match:
    detail.tokenizer.tokens.2.token: "buzz"
- match:
    detail.tokenfilters.0.tokens.0.token: "bar"
