EverythingToJSONSerializeredit

Serialize()edit

The EverythingToJSONSerializer tries to convert everything to JSON.

If the data provided was an empty array, the serializer manually converts the JSON from an empty array ([]) to an empty object ({}) so that it is valid JSON for Elasticsearch request bodies.

If the data was not an array and/or not convertible to JSON, the method returns null.

Deserialize()edit

When decoding the response body, everything is decoded to JSON from JSON. If the data is not valid JSON, null will be returned.

Selecting the EverythingToJSONSerializeredit

You can select EverythingToJSONSerializer by using the setSerializer() method on the ClientBuilder object:

$client = ClientBuilder::create()
            ->setSerializer('\Elasticsearch\Serializers\EverythingToJSONSerializer');
            ->build();

Note that the serializer is configured by specifying a namespace path to the serializer.