ES build fails due to illegal_argument_exception

I have recently changed my ES mappings and now getting an exception on deploy

Activity execution failed, because:
      Elasticsearch\Common\Exceptions\BadRequest400Exception  : {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"mapper [created_at] of different type, current_type [text], merged_type [date]"}],"type":"illegal_argument_exception","reason":"mapper [created_at] of different type, current_type [text], merged_type [date]"},"status":400}

  at /var/app/ondeck/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:610
  606|             $exception = new ScriptLangNotSupportedException($responseBody. $statusCode);
  607|         } elseif ($statusCode === 408) {
  608|             $exception = new RequestTimeout408Exception($responseBody, $statusCode);
  609|         } else {
  > 610|             $exception = new BadRequest400Exception($responseBody, $statusCode);
  611|         }
  613|         $this->logRequestFail(
  614|             $request['http_method'],

  Exception trace:

  1   Elasticsearch\Connections\Connection::process4xxError(["PUT", "http", "/categories/categories/_mapping", "{"categories":{"_source":{"enabled":true},"properties":{"id":{"type":"integer"},"created_at":{"type":"date","format":"yyyy-MM-dd HH:mm:ss"},"updated_at":{"type":"date","format":"yyyy-MM-dd HH:mm:ss"}}}}"], []

Anyone would be able to help out with ?


Elasticsearch doesn't allow you to update existing field mappings, which I think is the problem. Check the doc. A new index can be created with the appropriate mapping and you can reindex your data into that index. An alias can really help with this process, check this doc.

Hope that helped :slight_smile:

1 Like

Sorry for the late reply, @tdasch!

Indeed - that was very helpful. Thanks once again!

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