---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    indices.create:
      index: "test"
      body:
        mappings:
          properties:
            title:
              type: "keyword"
            suggestions:
              type: "completion"
              contexts:
              - name: "format"
                type: "category"
    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:
    bulk:
      refresh: true
      index: "test"
      body:
      - "{\"index\": {}}"
      - "{\"title\": \"Elasticsearch in Action\", \"suggestions\": {\"input\": \"\
        ELK in Action\", \"contexts\": {\"format\": \"ebook\"}}}"
      - "{\"index\": {}}"
      - "{\"title\": \"Elasticsearch - The Definitive Guide\", \"suggestions\": {\"\
        input\": [\"Elasticsearch in Action\"], \"contexts\": {\"format\": \"ebook\"\
        }}}"
    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"
---
Test typed keys parameter for suggesters:
- do:
    search:
      rest_total_hits_as_int: true
      typed_keys: true
      body:
        query:
          match_all: {}
        suggest:
          text: "Elastic"
          term_suggester:
            term:
              field: "title"
          context_suggester:
            prefix: "Elastic"
            completion:
              field: "suggestions"
              contexts:
                format: "ebook"
          phrase_suggester:
            phrase:
              field: "title"
    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"
- is_true: "suggest.term#term_suggester"
- is_true: "suggest.completion#context_suggester"
- is_true: "suggest.phrase#phrase_suggester"
