4

Im trying to add type to index like this:

PUT /catalog/_mapping/product
    {
      "properties": {
        "name": {
          "type":"text"
        }
      }
    }

In answer I get an error:

{
  "error" : "no handler found for uri [/catalog/_mapping/product?pretty=true] and method [PUT]"
}

The same situation in CURL. How I can fix it?

rokoman13
  • 41
  • 1
  • 1
  • 3

2 Answers2

5

I assume you use ElasticSearch 8.x version.

From ElasticSearch 8.x version, only _doc is supported and it is just an endpoint name, not a document type. So try with:

PUT /catalog/_doc/product
{
  "properties": {
    "name": {
      "type":"text"
    }
  }
}
Rubén Aguado
  • 123
  • 2
  • 9
1

There's no need to specify anything after _mapping since there can only be a single mapping type in an index mapping.

So simply like this will work:

PUT /catalog/_mapping
{
  "properties": {
    "name": {
      "type":"text"
    }
  }
}
Val
  • 207,596
  • 13
  • 358
  • 360