Skip to content

Get field mapping API returns empty response on wildcard-included search_as_you_type field #118636

Open
@tmoschou

Description

@tmoschou

Elasticsearch Version

8.16.1

Installed Plugins

analysis-icu, mapper-size

Java Version

OpenJDK Runtime Environment (build 17.0.13+12-LTS)

OS Version

Linux elasticsearch-master-0 5.10.207 #1 SMP PREEMPT Tue Sep 3 18:23:52 UTC 2024 aarch64 GNU/Linux

Problem Description

Get field mapping query with a wildcard field matching any field of type search_as_you_type causes server to respond with empty response {}.

Steps to Reproduce

  1. Create index

    curl -X PUT localhost:9200/my-index -H 'Content-Type: application/json' -d '
    {
        "mappings": {
            "properties": {
                "field1a": { "type": "search_as_you_type" },
                "field1b": { "type": "text" },
                "field2a": { "type": "text" },
                "field2b": { "type": "text" }
            }
        }
    }'
    
  2. Query field mapping

    curl -X GET 'localhost:9200/my-index/_mapping/field/field1*'
    

    Expected behaviour

    Step 2 returns:

    {
      "my-index": {
        "mappings": {
          "field1a": {
            "full_name": "field1a",
            "mapping": {
              "field1a": {
                "type": "search_as_you_type",
                "doc_values" : false,
                "max_shingle_size" : 3
              }
            }
          },
          "field1b": {
            "full_name": "field1b",
            "mapping": {
              "field1b": {
                "type": "text"
              }
            }
          }
        }
      }
    }
    

    Actual behaviour
    Step 2 returns:

    {}
    

    Not only is field1a not returned, but neither is any other field matched (E.g. field1b, or all other fields if using /_mapping/field/* ).

  3. Querying non-existing fields return differently

    curl -X GET 'localhost:9200/my-index/_mapping/field/field3*'
    {"my-index":{"mappings":{}}}
    
  4. Querying the search_as_you_type exactly without wildcard does work

    curl -X GET 'localhost:9200/my-index/_mapping/field/field1a'
    {
      "my-index": {
        "mappings": {
          "field1a": {
            "full_name": "field1a",
            "mapping": {
              "field1a": {
                "type": "search_as_you_type",
                "doc_values": false,
                "max_shingle_size": 3
              }
            }
          }
        }
      }
    }
    

Logs (if relevant)

No logs lines are written

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/MappingIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearchpriority:normalA label for assessing bug priority to be used by ES engineers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions