Elasticsearch support Normalization error
See original GitHub issueHi everyone, Thanks for this great work !
I’m using api-platform/core": "^2.4.0-beta.1", I followed Documentation to set up the Elasticsearch support and when I want to GET a collection with a DateTime attribute
/**
* @var \DateTimeInterface
*
* @Gedmo\Timestampable(on="create")
* @ORM\Column(name="created_at", type="datetime")
* @Groups("timestampable_read")
*/
private $createdAt;
I have the following issue :
Cannot create an instance of DateTime from serialized data because its constructor requires parameter \"time\" to be present.
Stack trace
Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException:
Cannot create an instance of DateTime from serialized data because its constructor requires parameter "time" to be present.
at vendor/symfony/serializer/Normalizer/AbstractNormalizer.php:428
at Symfony\Component\Serializer\Normalizer\AbstractNormalizer->instantiateObject(array('2015-01-01T12:10:30Z'), 'DateTime', array('allow_extra_attributes' => true, 'cache_key' => '601c065ecd9ab622c622bbc62f7e38dc'), object(ReflectionClass), false, 'elasticsearch')
(vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:157)
at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->instantiateObject(array('2015-01-01T12:10:30Z'), 'DateTime', array('allow_extra_attributes' => true, 'cache_key' => '601c065ecd9ab622c622bbc62f7e38dc'), object(ReflectionClass), false, 'elasticsearch')
(vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:262)
at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->denormalize('2015-01-01T12:10:30Z', 'DateTime', 'elasticsearch', array('allow_extra_attributes' => true, 'cache_key' => '601c065ecd9ab622c622bbc62f7e38dc'))
(vendor/api-platform/core/src/Bridge/Elasticsearch/Serializer/ItemNormalizer.php:64)
at ApiPlatform\Core\Bridge\Elasticsearch\Serializer\ItemNormalizer->denormalize('2015-01-01T12:10:30Z', 'DateTime', 'elasticsearch', array('allow_extra_attributes' => true, 'cache_key' => '601c065ecd9ab622c622bbc62f7e38dc'))
(vendor/symfony/serializer/Serializer.php:191)
at Symfony\Component\Serializer\Serializer->denormalize('2015-01-01T12:10:30Z', 'DateTime', 'elasticsearch', array('allow_extra_attributes' => true, 'cache_key' => '601c065ecd9ab622c622bbc62f7e38dc'))
(vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:352)
at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->validateAndDenormalize('App\\User\\Entity\\User', 'createdAt', '2015-01-01T12:10:30Z', 'elasticsearch', array('allow_extra_attributes' => true, 'cache_key' => '601c065ecd9ab622c622bbc62f7e38dc'))
(vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:277)
at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->denormalize(array('full_name' => 'Lucky', 'username' => 'jdoe', 'site' => '/sites/f45b3272-122a-4e29-a257-65c6d22829cd', 'plain_password' => 'Passw0rd!', 'admin' => false, 'sedentary_edenred_admin' => false, 'enabled' => true, 'roles' => array('ROLE_CE_LISTE_UPDATE', 'ROLE_ONGLET_PARAMETRES_AVANCES_UPDATE'), 'store' => '/stores/00000000-0000-0000-0000-000000000001', 'created_at' => '2015-01-01T12:10:30Z', 'uuid' => '0HjozWgBJzObu7ogPBVG'), 'App\\User\\Entity\\User', 'elasticsearch', array('allow_extra_attributes' => true, 'cache_key' => '601c065ecd9ab622c622bbc62f7e38dc'))
...
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
normalizer | Elasticsearch Guide [8.5] | Elastic
The normalizer is applied prior to indexing the keyword, as well as at search-time when the keyword field is searched via a query...
Read more >Cannot normalize the point - not a number - Opster
A detailed guide on how to resolve errors related to "cannot normalize the point - not a number"
Read more >Elasticsearch - How to normalize score when combining ...
Thirdly the problem they were trying to solve was quite different. Lastly I lack the source code that would help me to understand...
Read more >Normalize data with Amazon Elasticsearch Service ingest ...
Your logstash source sends the data to an index with the name index-YYYY.MM.DD.HH (hours in the end). When you have an error in...
Read more >Elastic Common Schema (ECS) Reference
The goal of ECS is to enable and encourage users of Elasticsearch to normalize their event data, so that they can better analyze,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This is definitely a bug, we’re in the process of fixing priority issues in https://github.com/api-platform/core/pull/2495
To avoid the issue I had this in
service.yamlwith a priority higher than api_platform.elasticsearch.normalizer.item