# How to validate user input?

**URL:** <https://discuss.elastic.co/t/how-to-validate-user-input/19071>\
**Category:** Elasticsearch\
**Created:** [August 4, 2014, 3:20pm UTC](https://discuss.elastic.co/t/how-to-validate-user-input/19071 "2014-08-04T15:20:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![esc](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@esc](https://discuss.elastic.co/u/esc)\
**Post date:** [August 4, 2014, 3:20pm UTC](https://discuss.elastic.co/t/how-to-validate-user-input/19071/1 "2014-08-04T15:20:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:11am UTC](https://discuss.elastic.co/t/how-to-validate-user-input/19071/2 "2017-07-06T01:11:00Z")

</div>


