# Multifield search using java api

**URL:** https://discuss.elastic.co/t/multifield-search-using-java-api/22746
**Category:** Elasticsearch
**Created:** [March 18, 2015, 6:20pm UTC](https://discuss.elastic.co/t/multifield-search-using-java-api/22746 "2015-03-18T18:20:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![11181](https://avatars.discourse-cdn.com/v4/letter/1/34f0e0/32.png) [@11181](https://discuss.elastic.co/u/11181)
#### Post date: [March 18, 2015, 6:20pm UTC](https://discuss.elastic.co/t/multifield-search-using-java-api/22746/1 "2015-03-18T18:20:04Z")

</div>

I have three fields: authorId, title,content.

Could any one provide code how to make query that will find expression "english grammer" in title and content of the author with id=10?  
Please, just a piece of code, as I've read MatchQuery, MultiMatch,BooleanQuery but can't understand how to do that.

SearchResponse response = client.prepareSearch("test")  
.setTypes("book")  
.setSearchType(SearchType.QUERY\_AND\_FETCH)  
.setQuery(????????????????????????)  
.setFrom(startFrom).setSize(10).setExplain(true)  
.execute()  
.actionGet();

--  
Александр Свиридов

--  
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/1426702804.14201996%40f263.i.mail.ru](https://groups.google.com/d/msgid/elasticsearch/1426702804.14201996%40f263.i.mail.ru).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:25am UTC](https://discuss.elastic.co/t/multifield-search-using-java-api/22746/2 "2017-07-06T00:25:46Z")

</div>


