# Indexing and searching special characters java

**URL:** <https://discuss.elastic.co/t/indexing-and-searching-special-characters-java/183257>\
**Category:** Elasticsearch\
**Created:** [May 29, 2019, 7:34am UTC](https://discuss.elastic.co/t/indexing-and-searching-special-characters-java/183257 "2019-05-29T07:34:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahilkumar](https://avatars.discourse-cdn.com/v4/letter/s/ed655f/32.png) [@sahilkumar](https://discuss.elastic.co/u/sahilkumar)\
**Post date:** [May 29, 2019, 7:34am UTC](https://discuss.elastic.co/t/indexing-and-searching-special-characters-java/183257/1 "2019-05-29T07:34:19Z")

</div>

I need to index the my documents as they are without removing the special characters. I also need to search for the exact phrase such as: s\*\*  
When I search for s\*\* using mathphrase query it removes \*\* from the phrase and searches only for s.  
I also don't know how to use analyzer and tokenizers in my java code. Please explain that as well.  
This is the java code I use to create my index.  
i\> ndent preform IndicesAdminClient indicesAdminClient = client.admin().indices();

> ```
> indicesAdminClient.prepareCreate(elasticSearch.productIndexName)
> .setSettings(Settings.builder()
> .put("index.mapping.total_fields.limit", indexFieldLimit)
> .put("refresh_interval", -1)
> .put("index.number_of_replicas",0))
> .get();
> 
> ```

This is my search query code -

> boolQuery.must(multiMatchQuery(bannedKeyword).type(MatchQuery.Type.PHRASE));

---

<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:** [June 26, 2019, 7:34am UTC](https://discuss.elastic.co/t/indexing-and-searching-special-characters-java/183257/2 "2019-06-26T07:34:21Z")

</div>

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