in src/Traits/EndpointTrait.php [111:125]
protected function bodySerialize($body, string $contentType): string
{
if (strpos($contentType, 'application/x-ndjson') !== false ||
strpos($contentType, 'application/vnd.elasticsearch+x-ndjson') !== false) {
return NDJsonSerializer::serialize($body, ['remove_null' => false]);
}
if (strpos($contentType, 'application/json') !== false ||
strpos($contentType, 'application/vnd.elasticsearch+json') !== false) {
return JsonSerializer::serialize($body, ['remove_null' => false]);
}
throw new ContentTypeException(sprintf(
"The Content-Type %s is not managed by Elasticsearch serializer",
$contentType
));
}