Skip to content

Conversation

@Samiul-TheSoccerFan
Copy link
Contributor

@Samiul-TheSoccerFan Samiul-TheSoccerFan commented Feb 18, 2025

Response with better error message if an index field type is invalid or unknown.

PUT index1
{
  "mappings": {
    "properties": {
      "content": {
        "type": "text1"
      }
    }
  }
}

will now return the updated error message:

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "The mapper type [text1] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation."
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping: The mapper type [text1] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation.",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "The mapper type [text1] does not exist. It might have been created within a future version or requires a plugin to be installed. Check the documentation."
    }
  },
  "status": 400
}

@Samiul-TheSoccerFan Samiul-TheSoccerFan added v9.0.0 v8.18.1 v8.19.0 v9.0.1 auto-backport Automatically create backport pull requests when merged >enhancement labels Feb 18, 2025
@Samiul-TheSoccerFan
Copy link
Contributor Author

Do we need to update the error message for these places too?

throw new MapperParsingException("No handler for type [" + type + "] declared on runtime field [" + fieldName + "]");

The error message can be reproduced with this:

PUT index6
{
  "mappings": {
    "runtime": {
      "day_of_week": {
        "type": "keyword1"
      }
    }
  }
}

throw new MapperParsingException("no handler for type [" + type + "] declared on field [" + multiFieldName + "]");

The error message can be reproduced with this:

PUT index8
{
  "mappings": {
    "properties": {
      "city": {
        "type": "text",
        "fields": {
          "raw": { 
            "type":  "keyword1"
          }
        }
      }
    }
  }
}

@Mikep86 Mikep86 added :SearchOrg/Relevance Label for the Search (solution/org) Relevance team and removed auto-backport Automatically create backport pull requests when merged v9.0.0 v8.18.1 v9.0.1 labels Feb 19, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @Samiul-TheSoccerFan, I've created a changelog YAML for you.

@Mikep86 Mikep86 added the auto-backport Automatically create backport pull requests when merged label Feb 19, 2025
Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on the other places this error is thrown, we need to update those as well and add tests for those cases.

@Mikep86
Copy link
Contributor

Mikep86 commented Feb 19, 2025

Also, it's important to note that we don't backport enhancements to released stack versions (or stack versions after FF). Only bug fixes are eligible for backporting.

@Samiul-TheSoccerFan Samiul-TheSoccerFan marked this pull request as ready for review February 21, 2025 20:13
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/search-eng (Team:SearchOrg)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/search-relevance (Team:Search - Relevance)

@Mikep86
Copy link
Contributor

Mikep86 commented Feb 21, 2025

@elasticmachine update branch

Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking a lot better! Just a couple small things to clean up.

@Samiul-TheSoccerFan
Copy link
Contributor Author

@elasticmachine update branch

Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the iterations!

@Samiul-TheSoccerFan Samiul-TheSoccerFan merged commit 5664f4f into elastic:main Feb 24, 2025
17 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 122860

@Mikep86
Copy link
Contributor

Mikep86 commented Feb 24, 2025

@Samiul-TheSoccerFan Can you fix the backport PR?

@Samiul-TheSoccerFan
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Questions ?

Please refer to the Backport tool documentation

Samiul-TheSoccerFan added a commit that referenced this pull request Feb 25, 2025
… (#123311)

* Improved error message when index field type is unknown (#122860)

* Updating error message when index field type is unknown

* Fix style issue

* Add yaml test for invalid field type error message

* Update docs/changelog/122860.yaml

* Updating error message for runtime and multi field type parser

* add and fix yaml tests

* Fix code styles by running spotlessApply

* Update changelog

* Updatig the test in yml

* Updating error message for runtime

* Fix failing yaml tests

* Update error message to Fix unit tests

* fix serverless qa test

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit 5664f4f)

# Conflicts:
#	server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java

* remove changes from other PRs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged backport pending >enhancement :SearchOrg/Relevance Label for the Search (solution/org) Relevance team v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants