# NoSQL Injection via the Java Client

**URL:** <https://discuss.elastic.co/t/nosql-injection-via-the-java-client/105463>\
**Category:** Elasticsearch\
**Created:** [October 26, 2017, 5:58pm UTC](https://discuss.elastic.co/t/nosql-injection-via-the-java-client/105463 "2017-10-26T17:58:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg\_Cox](https://avatars.discourse-cdn.com/v4/letter/g/35a633/32.png) [@Greg\_Cox](https://discuss.elastic.co/u/Greg_Cox)\
**Post date:** [October 26, 2017, 5:58pm UTC](https://discuss.elastic.co/t/nosql-injection-via-the-java-client/105463/1 "2017-10-26T17:58:18Z")

</div>

Hi there,  
I've implemented a basic search backed by an ES cluster. In a code review, my colleague asked if there was the possibility of a NoSQL injection attack. I assume that the QueryBuilder protected against injection attacks but that's not explicit in the documentation. Is it best practice to filter user-supplied query terms before using a QueryBuilder, or to rely on QueryBuilder's protection?

I'm using 5.5.1.

Thanks,  
Greg

---

<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:** [November 23, 2017, 5:58pm UTC](https://discuss.elastic.co/t/nosql-injection-via-the-java-client/105463/2 "2017-11-23T17:58:30Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
