# Corresponding java call?

**URL:** https://discuss.elastic.co/t/corresponding-java-call/3491
**Category:** Elasticsearch
**Created:** [October 30, 2010, 4:22am UTC](https://discuss.elastic.co/t/corresponding-java-call/3491 "2010-10-30T04:22:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Diptamay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diptamay/32/2805_2.png) [@Diptamay](https://discuss.elastic.co/u/Diptamay)
#### Post date: [October 30, 2010, 4:22am UTC](https://discuss.elastic.co/t/corresponding-java-call/3491/1 "2010-10-30T04:22:35Z")

</div>

Hi All

Have a couple of questions:

1. Could anyone tell me, whats the corresponding fieldQuery java api  
call for  
"field" : {  
"\_all" : "jeter"  
}

in the query below?

{  
"query" : {  
"bool" : {  
"must" : [  
{  
"field" : {  
"\_all" : "jeter"  
}  
},  
{  
"field" : {  
"tags.subject.value" : "MLBCOM\_TOP\_PLAY"  
}  
}  
],  
"must\_not" : {  
"field" : {  
"tags.subject.value" :  
"MLBCOM\_REALTIME\_HIGHLIGHT"  
}  
}  
}  
},  
"size" : 10  
}

1. Also  
"field" : {  
"\_all" : "jeter"  
}  
would look for jeter in any of the fields in the documents right?

Thanks  
Diptamay

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [October 30, 2010, 7:01pm UTC](https://discuss.elastic.co/t/corresponding-java-call/3491/2 "2010-10-30T19:01:00Z")

</div>

All queries can be constructed using the QueryBuilders static factory  
methods (filters can be created using FilterBuilders).  
QueryBuilders#fieldQuery is the one you are after.

-shay.banon

On Sat, Oct 30, 2010 at 6:22 AM, diptamay [diptamay@gmail.com](mailto:diptamay@gmail.com) wrote:

> Hi All
> 
> Have a couple of questions:
> 
> 1. Could anyone tell me, whats the corresponding fieldQuery java api  
> call for  
> "field" : {  
> "\_all" : "jeter"  
> }
> 
> in the query below?
> 
> {  
> "query" : {  
> "bool" : {  
> "must" : [  
> {  
> "field" : {  
> "\_all" : "jeter"  
> }  
> },  
> {  
> "field" : {  
> "tags.subject.value" : "MLBCOM\_TOP\_PLAY"  
> }  
> }  
> ],  
> "must\_not" : {  
> "field" : {  
> "tags.subject.value" :  
> "MLBCOM\_REALTIME\_HIGHLIGHT"  
> }  
> }  
> }  
> },  
> "size" : 10  
> }
> 
> 1. Also  
> "field" : {  
> "\_all" : "jeter"  
> }  
> would look for jeter in any of the fields in the documents right?
> 
> Thanks  
> Diptamay

---

<div class="post-metadata">

### Author: ![Diptamay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diptamay/32/2805_2.png) [@Diptamay](https://discuss.elastic.co/u/Diptamay)
#### Post date: [October 30, 2010, 7:43pm UTC](https://discuss.elastic.co/t/corresponding-java-call/3491/3 "2010-10-30T19:43:15Z")

</div>

Thanks Shay,

Yes, I know of fieldQuery, but would specifying fieldQuery("\_all",  
value) search across all fields in the document, because I thought in  
fieldQuery("fieldkey","value"), it would look for that specific  
field.

Is my understanding wrong or fieldQuery("\_all", value) will work for  
me?

Thanks  
Diptamay

On Oct 30, 3:01 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> All queries can be constructed using the QueryBuilders static factory  
> methods (filters can be created using FilterBuilders).  
> QueryBuilders#fieldQuery is the one you are after.
> 
> -shay.banon
> 
> On Sat, Oct 30, 2010 at 6:22 AM, diptamay [dipta...@gmail.com](mailto:dipta...@gmail.com) wrote:
> 
> > Hi All
> 
> > Have a couple of questions:
> > 
> > 1. Could anyone tell me, whats the corresponding fieldQuery java api  
> > call for  
> > "field" : {  
> > "\_all" : "jeter"  
> > }
> 
> > in the query below?
> 
> > {  
> > "query" : {  
> > "bool" : {  
> > "must" : [  
> > {  
> > "field" : {  
> > "\_all" : "jeter"  
> > }  
> > },  
> > {  
> > "field" : {  
> > "tags.subject.value" : "MLBCOM\_TOP\_PLAY"  
> > }  
> > }  
> > ],  
> > "must\_not" : {  
> > "field" : {  
> > "tags.subject.value" :  
> > "MLBCOM\_REALTIME\_HIGHLIGHT"  
> > }  
> > }  
> > }  
> > },  
> > "size" : 10  
> > }
> 
> > 1. Also  
> > "field" : {  
> > "\_all" : "jeter"  
> > }  
> > would look for jeter in any of the fields in the documents right?
> 
> > Thanks  
> > Diptamay

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [October 30, 2010, 10:40pm UTC](https://discuss.elastic.co/t/corresponding-java-call/3491/4 "2010-10-30T22:40:13Z")

</div>

Yes, it will. The \_all if a special field that includes all the other  
fields.

-shay.banon

On Sat, Oct 30, 2010 at 9:43 PM, diptamay [diptamay@gmail.com](mailto:diptamay@gmail.com) wrote:

> Thanks Shay,
> 
> Yes, I know of fieldQuery, but would specifying fieldQuery("\_all",  
> value) search across all fields in the document, because I thought in  
> fieldQuery("fieldkey","value"), it would look for that specific  
> field.
> 
> Is my understanding wrong or fieldQuery("\_all", value) will work for  
> me?
> 
> Thanks  
> Diptamay
> 
> On Oct 30, 3:01 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > All queries can be constructed using the QueryBuilders static factory  
> > methods (filters can be created using FilterBuilders).  
> > QueryBuilders#fieldQuery is the one you are after.
> > 
> > -shay.banon
> > 
> > On Sat, Oct 30, 2010 at 6:22 AM, diptamay [dipta...@gmail.com](mailto:dipta...@gmail.com) wrote:
> > 
> > > Hi All
> > 
> > > Have a couple of questions:
> > > 
> > > 1. Could anyone tell me, whats the corresponding fieldQuery java api  
> > > call for  
> > > "field" : {  
> > > "\_all" : "jeter"  
> > > }
> > 
> > > in the query below?
> > 
> > > {  
> > > "query" : {  
> > > "bool" : {  
> > > "must" : [  
> > > {  
> > > "field" : {  
> > > "\_all" : "jeter"  
> > > }  
> > > },  
> > > {  
> > > "field" : {  
> > > "tags.subject.value" : "MLBCOM\_TOP\_PLAY"  
> > > }  
> > > }  
> > > ],  
> > > "must\_not" : {  
> > > "field" : {  
> > > "tags.subject.value" :  
> > > "MLBCOM\_REALTIME\_HIGHLIGHT"  
> > > }  
> > > }  
> > > }  
> > > },  
> > > "size" : 10  
> > > }
> > 
> > > 1. Also  
> > > "field" : {  
> > > "\_all" : "jeter"  
> > > }  
> > > would look for jeter in any of the fields in the documents right?
> > 
> > > Thanks  
> > > Diptamay

---

<div class="post-metadata">

### Author: ![Diptamay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diptamay/32/2805_2.png) [@Diptamay](https://discuss.elastic.co/u/Diptamay)
#### Post date: [October 31, 2010, 5:35pm UTC](https://discuss.elastic.co/t/corresponding-java-call/3491/5 "2010-10-31T17:35:49Z")

</div>

Shay, thanks for the help.

On Oct 30, 6:40 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Yes, it will. The \_all if a special field that includes all the other  
> fields.
> 
> -shay.banon
> 
> On Sat, Oct 30, 2010 at 9:43 PM, diptamay [dipta...@gmail.com](mailto:dipta...@gmail.com) wrote:
> 
> > Thanks Shay,
> 
> > Yes, I know of fieldQuery, but would specifying fieldQuery("\_all",  
> > value) search across all fields in the document, because I thought in  
> > fieldQuery("fieldkey","value"), it would look for that specific  
> > field.
> 
> > Is my understanding wrong or fieldQuery("\_all", value) will work for  
> > me?
> 
> > Thanks  
> > Diptamay
> 
> > On Oct 30, 3:01 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > All queries can be constructed using the QueryBuilders static factory  
> > > methods (filters can be created using FilterBuilders).  
> > > QueryBuilders#fieldQuery is the one you are after.
> 
> > > -shay.banon
> 
> > > On Sat, Oct 30, 2010 at 6:22 AM, diptamay [dipta...@gmail.com](mailto:dipta...@gmail.com) wrote:
> > > 
> > > > Hi All
> 
> > > > Have a couple of questions:
> > > > 
> > > > 1. Could anyone tell me, whats the corresponding fieldQuery java api  
> > > > call for  
> > > > "field" : {  
> > > > "\_all" : "jeter"  
> > > > }
> 
> > > > in the query below?
> 
> > > > {  
> > > > "query" : {  
> > > > "bool" : {  
> > > > "must" : [  
> > > > {  
> > > > "field" : {  
> > > > "\_all" : "jeter"  
> > > > }  
> > > > },  
> > > > {  
> > > > "field" : {  
> > > > "tags.subject.value" : "MLBCOM\_TOP\_PLAY"  
> > > > }  
> > > > }  
> > > > ],  
> > > > "must\_not" : {  
> > > > "field" : {  
> > > > "tags.subject.value" :  
> > > > "MLBCOM\_REALTIME\_HIGHLIGHT"  
> > > > }  
> > > > }  
> > > > }  
> > > > },  
> > > > "size" : 10  
> > > > }
> 
> > > > 1. Also  
> > > > "field" : {  
> > > > "\_all" : "jeter"  
> > > > }  
> > > > would look for jeter in any of the fields in the documents right?
> 
> > > > Thanks  
> > > > Diptamay

---

<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, 4:17am UTC](https://discuss.elastic.co/t/corresponding-java-call/3491/6 "2017-07-06T04:17:23Z")

</div>


