# What's wrong with my match query in Java API?

**URL:** <https://discuss.elastic.co/t/whats-wrong-with-my-match-query-in-java-api/16036>\
**Category:** Elasticsearch\
**Created:** [February 26, 2014, 3:13pm UTC](https://discuss.elastic.co/t/whats-wrong-with-my-match-query-in-java-api/16036 "2014-02-26T15:13:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Guo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_guo/32/1725_2.png) [@Daniel\_Guo](https://discuss.elastic.co/u/Daniel_Guo)\
**Post date:** [February 26, 2014, 3:13pm UTC](https://discuss.elastic.co/t/whats-wrong-with-my-match-query-in-java-api/16036/1 "2014-02-26T15:13:58Z")

</div>

I want to do a match query, and the query works fine in REST:

curl -XGET 'localhost:9200/search/video\_search/\_search?pretty' -d @query.  
json

query.json:  
{  
"query": {  
"match": {  
"tvName": {  
"query": "决战华岩寺",  
"operator": "or",  
"minimum\_should\_match": "2"  
}  
}  
}  
}

but I don't know how to do it in Java, my code below doesn't work:

MatchQueryBuilder queryBuilder = QueryBuilders.matchQuery("tvName", keyword)  
.minimumShouldMatch("2")  
.operator(MatchQueryBuilder.Operator.OR);

the exception is : Unexpected end of block of data.

Cloud anybody help? Thanks very much.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/86a21181-8007-4595-abc9-4b45f81b67a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/86a21181-8007-4595-abc9-4b45f81b67a3%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [February 26, 2014, 3:57pm UTC](https://discuss.elastic.co/t/whats-wrong-with-my-match-query-in-java-api/16036/2 "2014-02-26T15:57:42Z")

</div>

Hmmm, not sure. I tired this and it worked for me:

```
  q = QueryBuilders.matchQuery("tvName", "决战华岩寺")
      .minimumShouldMatch("1")
      .operator(MatchQueryBuilder.Operator.OR);

```

Perhaps can you give a complete example of an index, 1 document, and the  
actual full Java query to duplicate your problem?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/723c084a-7549-4f3e-9109-77342bbc24bf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/723c084a-7549-4f3e-9109-77342bbc24bf%40googlegroups.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, 1:47am UTC](https://discuss.elastic.co/t/whats-wrong-with-my-match-query-in-java-api/16036/3 "2017-07-06T01:47:09Z")

</div>


