<commit_before>[[search-suggesters-completion]]
=== Completion Suggester

NOTE: In order to understand the format of suggestions, please
read the <<search-suggesters>> page first.

The `completion` suggester provides auto-complete/search-as-you-type
functionality. This is a navigational feature to guide users to
relevant results as they are typing, improving search precision.
It is not meant for spell correction or did-you-mean functionality
like the `term` or `phrase` suggesters.

Ideally, auto-complete functionality should be as fast as a user
types to provide instant feedback relevant to what a user has already
typed in. Hence, `completion` suggester is optimized for speed.
The suggester uses data structures that enable fast lookups,
but are costly to build and are stored in-memory.

[[completion-suggester-mapping]]
==== Mapping

To use this feature, specify a special mapping for this field,
which indexes the field values for fast completions.

[source,js]
--------------------------------------------------
PUT music
{
    "mappings": {
        "_doc" : {
            "properties" : {
                "suggest" : {
                    "type" : "completion"
                },
                "title" : {
                    "type": "keyword"
                }
            }
        }
    }
}
--------------------------------------------------
// CONSOLE
// TESTSETUP

Mapping supports the following parameters:

[horizontal]
`analyzer`::
    The index analyzer to use, defaults to `simple`.
    In case you are wondering why we did not opt for the `standard`
    analyzer: We try to have easy to understand behaviour here, and if you
    index the field content `At the Drive-in`, you will not get any
    suggestions for `a`, nor for `d` (the first non stopword).

`search_analyzer`::
    The search analyzer to use, defaults to value of `analyzer`.

`preserve_separators`::
    Preserves the separators, defaults to `true`.
    If disabled, you could find a field starting with `Foo Fighters`, if you
    suggest for `foof`.

`preserve_position_increments`::<commit_msg>[Docs] Delete explanation for completion suggester default analyzer choice (#36720)<commit_after>[[search-suggesters-completion]]
=== Completion Suggester

NOTE: In order to understand the format of suggestions, please
read the <<search-suggesters>> page first.

The `completion` suggester provides auto-complete/search-as-you-type
functionality. This is a navigational feature to guide users to
relevant results as they are typing, improving search precision.
It is not meant for spell correction or did-you-mean functionality
like the `term` or `phrase` suggesters.

Ideally, auto-complete functionality should be as fast as a user
types to provide instant feedback relevant to what a user has already
typed in. Hence, `completion` suggester is optimized for speed.
The suggester uses data structures that enable fast lookups,
but are costly to build and are stored in-memory.

[[completion-suggester-mapping]]
==== Mapping

To use this feature, specify a special mapping for this field,
which indexes the field values for fast completions.

[source,js]
--------------------------------------------------
PUT music
{
    "mappings": {
        "_doc" : {
            "properties" : {
                "suggest" : {
                    "type" : "completion"
                },
                "title" : {
                    "type": "keyword"
                }
            }
        }
    }
}
--------------------------------------------------
// CONSOLE
// TESTSETUP

Mapping supports the following parameters:

[horizontal]
`analyzer`::
    The index analyzer to use, defaults to `simple`.

`search_analyzer`::
    The search analyzer to use, defaults to value of `analyzer`.

`preserve_separators`::
    Preserves the separators, defaults to `true`.
    If disabled, you could find a field starting with `Foo Fighters`, if you
    suggest for `foof`.

`preserve_position_increments`::
{'fraction_non_alphanumeric': 0.12751509054325955, 'fraction_numerical': 0.0012575452716297787, 'mean_word_length': 2.5194690265486726, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6958995', 'n_tokens_mistral': 1051, 'n_tokens_neox': 989, 'n_words': 440}