Update index type on field. It is possible?

Hi

I need change some fields created with index and doc_valueswith false for new value true. I'm working with Elasticsearch 8.5

{
  "analyzers": {
    "mappings": {
      "properties": {
         "pf1":{
           "type": "float",
           "index": false,
           "doc_values": false
          }
....

I've tried

$params = [
           'index' => 'analyzers',
           'body' => [
               '_source' => [
                   'enabled' => true
               ],
               'properties' => [
                   'pf1' => [
                       "type" => "float",
                       'index' => true
                   ]
               ]
           ]
       ];

       $response = $client->indices()->putSettings($params);

But get error.

{
	"error": {
		"root_cause": [{
			"type": "illegal_argument_exception",
			"reason": "unknown setting [index.properties.pf1.index] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
		}],
		"type": "illegal_argument_exception",
		"reason": "unknown setting [index.properties.pf1.index] please check that any required plugins are installed, or check the breaking changes documentation for removed settings",
		"suppressed": [{
			"type": "illegal_argument_exception",
			"reason": "unknown setting [index.properties.pf1.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
		}]
	},
	"status": 400
}

I think that I dont' understand well Updating Mapping or if change index and doc_values are elegibles for update or I need to use another way.

You need to reindex this, you cannot just change the mapping parameters.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.