# How to use TermQueryBuilder to search Chinese word?

**URL:** <https://discuss.elastic.co/t/how-to-use-termquerybuilder-to-search-chinese-word/28295>\
**Category:** Elasticsearch\
**Created:** [August 29, 2015, 11:53pm UTC](https://discuss.elastic.co/t/how-to-use-termquerybuilder-to-search-chinese-word/28295 "2015-08-29T23:53:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KennFalcon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kennfalcon/32/28460_2.png) [@KennFalcon](https://discuss.elastic.co/u/KennFalcon)\
**Post date:** [August 29, 2015, 11:53pm UTC](https://discuss.elastic.co/t/how-to-use-termquerybuilder-to-search-chinese-word/28295/1 "2015-08-29T23:53:26Z")

</div>

I put a Chinese word in the ElasticSearch. But when I want to search it by using TermQueryBuilder in Java API, I couldn't find the data. So, how to do?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [September 1, 2015, 4:32pm UTC](https://discuss.elastic.co/t/how-to-use-termquerybuilder-to-search-chinese-word/28295/2 "2015-09-01T16:32:44Z")

</div>

Unless you configured an analyzer your chinese words are are split into tokens, one character per token. The TermQueryBuilder doesn't analyze the query that you pass to it and tries to find a token that corresponds to your query as is. So, for example, if you text contains "黄山" it will be indexed as two term "黄" and "山". If you pass "黄山" to the term query builder it will try to search for a term "黄山" that doesn't exist in your index. In other words your search should use the same analyzer that you used during indexing. Try replacing TermQueryBuilder with MatchQueryBuilder, it will provide more reasonable results. However, if you are dealing with only Chinese text, you will get much better results using dedicated Chinese [analyzer](https://github.com/elastic/elasticsearch-analysis-smartcn).

---

<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 5, 2017, 11:52pm UTC](https://discuss.elastic.co/t/how-to-use-termquerybuilder-to-search-chinese-word/28295/3 "2017-07-05T23:52:51Z")

</div>


