---
"suggestions with synonyms":
  - do:
      indices.create:
          index: test
          body:
            settings:
              analysis:
                analyzer:
                  suggest_analyzer_synonyms:
                    type: custom
                    tokenizer: standard
                    filter: [ lowercase, my_synonyms ]
                filter:
                  my_synonyms:
                    type: synonym
                    synonyms: [ "foo,renamed"]
            mappings:
              properties:
                field:
                  type: completion
                  analyzer: suggest_analyzer_synonyms

  - do:
      index:
          index: test
          id: "1"
          body:
            field:
              input: [ "Foo Fighters" ]
          refresh: true

  - do:
      search:
        rest_total_hits_as_int: true
        index: test
        body:
          suggest:
            text: r
            test:
              completion:
                field: field
  - match: {suggest.test.0.options.0.text: Foo Fighters}
