Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search as you type missing field - problem #3767

Open
l-trotta opened this issue Feb 11, 2025 · 0 comments
Open

Search as you type missing field - problem #3767

l-trotta opened this issue Feb 11, 2025 · 0 comments

Comments

@l-trotta
Copy link
Contributor

Reported in the java repo.
Search as you type doesn’t support doc_values as a field, in fact trying to add it will result in a server error:

PUT my-index-sayt
{
  "mappings": {
    "properties": {
      "my_field": {
        "type": "search_as_you_type",
        "doc_values": true
      }
    }
  }
}

returns

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Cannot set [doc_values] on field of type [search_as_you_type]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping: Cannot set [doc_values] on field of type [search_as_you_type]",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "Cannot set [doc_values] on field of type [search_as_you_type]"
    }
  },
  "status": 400
}

But then, after a field mapper "search_as_you_type" has been correctly created, a GET will always have doc_values set as false:

{
  "my-index-sayt": {
    "mappings": {
      "properties": {
        "my_field": {
          "type": "search_as_you_type",
          "doc_values": false,
          "max_shingle_size": 3
        }
      }
    }
  }
}

There's a justification for this in a comment in the server code.

Possible ways to handle this:

  1. Just add the field, response will deserialize but requests could be sent wrong
  2. Use AdditionalProperty

I don't think we can have a separate response class since SearchAsYouTypeProperty is part of the Property variant and would complicate things a lot.

Field definition:

  /**
   * Cannot be set, will only be returned as false
   * @server_default false
   */
  doc_values?: boolean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant