Skip to content

[BUG] search_as_you_type not supporting multi-fields / subfields #5035

@iceman91176

Description

@iceman91176

Describe the bug
A search_as_you_type field accepts sub-fields in its mapping definition, but they are silently ignored. This issues has bee reported in elasticsearch here (elastic/elasticsearch#56326) and has been fixed here (elastic/elasticsearch#82430)

To Reproduce
Create field title of type search_as_you_type with sub-field sortable

PUT my_test
{
  "mappings": {
    "properties": {
      "title": {
        "type": "search_as_you_type",
        "fields": {
          "sortable": {
            "type": "keyword",
            "ignore_above": 256,
            "normalizer": "lowercase_normalizer"
          }
        }
      }
    }
  },
  "settings": {
    "analysis": {
      "normalizer": {
        "lowercase_normalizer": {
          "filter": [
            "lowercase"
          ],
          "type": "custom"
        }
      }
    }
  }
}

No error, but sortable field is not present in the mapping

{
    "my_test": {
        "aliases": {},
        "mappings": {
            "properties": {
                "title": {
                    "type": "search_as_you_type",
                    "doc_values": false,
                    "max_shingle_size": 3
                }
            }
        },
        "settings": {
            "index": {
                "number_of_shards": "1",
                "provided_name": "my_test",
                "creation_date": "1667374518829",
                "analysis": {
                    "normalizer": {
                        "lowercase_normalizer": {
                            "filter": [
                                "lowercase"
                            ],
                            "type": "custom"
                        }
                    }
                },
                "number_of_replicas": "1",
                "uuid": "A8M-Yhf3ReOi3ydAs0bnwA",
                "version": {
                    "created": "136247827"
                }
            }
        }
    }
}

Expected behavior
The mapping should contain all fields

Plugins
All that are part of the default docker image

Host/Environment (please complete the following information):

  • OS: Fedora Release 36
  • Version: 2.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv2.18.0Issues and PRs related to version 2.18.0v3.0.0Issues and PRs related to version 3.0.0

    Type

    No type

    Projects

    Status

    Next (Next Quarter)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions