Elasticsearch: Merge requests with title completion
Description
This is the first merge request to support merge request search-as-you-type for GitLab Duo #491727 (closed). Here, we will use the title field differently to support search-as-you-type with a recommended analyzer for this purpose.
This adds the following mapping:
"title" : {
"type" : "text",
"fields" : {
"completion" : {
"type" : "search_as_you_type",
"doc_values" : false,
"max_shingle_size" : 3,
"analyzer" : "title_completion_analyzer"
}
},
"analyzer" : "title_analyzer"
}
Search-as-you-type field type is supported in both Elasticsearch and OpenSearch:
- Elasticsearch https://www.elastic.co/guide/en/elasticsearch/reference/current/search-as-you-type.html
- OpenSearch https://opensearch.org/docs/latest/field-types/supported-field-types/search-as-you-type/
References:
- Multi-fields https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html
- Lowercase token filter https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lowercase-tokenfilter.html
- Stop token filter https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-stop-tokenfilter.html
Related to #479051 (closed)