How to validate user input?

I try to use

Elasticsearch\Endpoints\Indices\ValidateQuery

and i get some abstract error.

here is part of my code

$parm['hosts'] = array('localhost:80');
$test = new Elasticsearch\Endpoints\Indices\ValidateQuery($parm);
$test1 = new Elasticsearch\Endpoints\Indices\Validate\Query($parm);
$test->setBody($json);
$test->performRequest();

can someone tell give me example of the code that need to be in parm or some working example of the _validateapi in php. Thansk in front.