Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

A mapping example from the doc, gives mapper_parsing_exception error #766

Open
brugnara opened this issue Apr 17, 2018 · 5 comments
Open

Comments

@brugnara
Copy link

Hi.

The example shown in this chapter gives me an error

# this curl works
curl -XDELETE 'localhost:9200/my_store?pretty'

# this gives me the error below
curl -XPUT 'localhost:9200/my_store?pretty' -H 'Content-Type: application/json' -d'
{
    "mappings" : {
        "products" : {
            "properties" : {
                "productID" : {
                    "type" : "string",
                    "index" : "not_analyzed" 
                }
            }
        }
    }
}
'

error:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "No handler for type [string] declared on field [productID]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "Failed to parse mapping [products]: No handler for type [string] declared on field [productID]",
    "caused_by" : {
      "type" : "mapper_parsing_exception",
      "reason" : "No handler for type [string] declared on field [productID]"
    }
  },
  "status" : 400
}

May be the docs outdated?

Many thanks.

@brugnara
Copy link
Author

This seems similar to #609 but comes from a different document section.

@tcucchietti
Copy link
Contributor

tcucchietti commented Apr 26, 2018

@brugnara which version was the Elasticsearch version on which you tested this example ?

The string datatype is no longer supported if you're using Elasticearch v6.

See #737.

@brugnara
Copy link
Author

@tcucchietti yes, as I pointed out, the problem seems to be the outdated doc. I'm on Elastic 6, and following the current doc online I ran into this error. I've also linked the doc section.

Thanks.

@tcucchietti
Copy link
Contributor

You're welcome.

I'm not sure the definitive guide is being maintained since v2.X which is unfortunate.
If somebody stumbles across information about this situation, please share a link :)

@anjalisaini207
Copy link

anjalisaini207 commented Jun 14, 2018

Now Instead of Strings, There are two types keyword and text. If you don't want a analysed field use type keyword. For this example I used mapping like below:

curl -X PUT "localhost:9200/my_store" -H 'Content-Type: application/json' -d' { "mappings" : { "products" : { "properties" : { "productID" : { "type" : "keyword", "index" : "true" } } } } } '

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants