# QueryBuilders based query in elasticsearch for searching text mixed with special characters(John-one) across multple fields?

**URL:** <https://discuss.elastic.co/t/querybuilders-based-query-in-elasticsearch-for-searching-text-mixed-with-special-characters-john-one-across-multple-fields/14535>\
**Category:** Elasticsearch\
**Created:** [November 22, 2013, 6:26am UTC](https://discuss.elastic.co/t/querybuilders-based-query-in-elasticsearch-for-searching-text-mixed-with-special-characters-john-one-across-multple-fields/14535 "2013-11-22T06:26:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![y\_venkatesh](https://avatars.discourse-cdn.com/v4/letter/y/96bed5/32.png) [@y\_venkatesh](https://discuss.elastic.co/u/y_venkatesh)\
**Post date:** [November 22, 2013, 6:26am UTC](https://discuss.elastic.co/t/querybuilders-based-query-in-elasticsearch-for-searching-text-mixed-with-special-characters-john-one-across-multple-fields/14535/1 "2013-11-22T06:26:32Z")

</div>

I use This query in my application for getting all matched content without  
special characters from across fields.Here I pass `q` value as run time  
search text(John).Now problem is when I search for text(John-One) with  
special characters it's returns 0.

```
QueryBuilder queryBuilderForUserSearch =
QueryBuilders.boolQuery().must(QueryBuilders.fieldQuery("active", 

```

Boolean.TRUE))  
.must(QueryBuilders.fieldQuery("\_all", "_" + q + "_"));

Here `q` is my passing text. It's working fine when I pass only text (like  
`John`) without special characters(like `John-one`). But I should fetch  
with special characters also.

Please help me. Thanks in advance.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:05am UTC](https://discuss.elastic.co/t/querybuilders-based-query-in-elasticsearch-for-searching-text-mixed-with-special-characters-john-one-across-multple-fields/14535/2 "2017-07-06T02:05:28Z")

</div>


