# Searching a object and using fields in

**URL:** https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550
**Category:** Elasticsearch
**Created:** [November 10, 2010, 5:55pm UTC](https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550 "2010-11-10T17:55:17Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![bernd](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@bernd](https://discuss.elastic.co/u/bernd)
#### Post date: [November 10, 2010, 5:55pm UTC](https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550/1 "2010-11-10T17:55:17Z")

</div>

Hello,

I have indexed documents like this:

{  
"title": "Some title text here",  
"description": "some more text here",  
"object": {  
"c52a85d39125e6b4cdeaafb87c1ef565":"Text to be searched",  
"faf709ec2943202db7300bcc7eeb2930": "more text here"  
}  
}

When searching I would like to use the boost functionality. So queries look  
like this:

{  
"query": {  
"query\_string": {  
"fields":["title^3", "description^2", "object"],  
"query":"terms here"  
}  
}  
}

When running the example above the search is only performed in the fields  
"title" and "description". Is there any way to enable searching through all  
fields in the "object" like "object.\*"?

## Best regards, Bernd

View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html)  
Sent from the ElasticSearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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: [November 12, 2010, 10:41pm UTC](https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550/2 "2010-11-12T22:41:22Z")

</div>

No, there isn't currently, but can be implemented....

On Wed, Nov 10, 2010 at 7:55 PM, bernd [iberndlu@googlemail.com](mailto:iberndlu@googlemail.com) wrote:

> Hello,
> 
> I have indexed documents like this:
> 
> {  
> "title": "Some title text here",  
> "description": "some more text here",  
> "object": {  
> "c52a85d39125e6b4cdeaafb87c1ef565":"Text to be searched",  
> "faf709ec2943202db7300bcc7eeb2930": "more text here"  
> }  
> }
> 
> When searching I would like to use the boost functionality. So queries look  
> like this:
> 
> {  
> "query": {  
> "query\_string": {  
> "fields":["title^3", "description^2", "object"],  
> "query":"terms here"  
> }  
> }  
> }
> 
> When running the example above the search is only performed in the fields  
> "title" and "description". Is there any way to enable searching through all  
> fields in the "object" like "object.\*"?
> 
> ## Best regards, Bernd
> 
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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: [November 12, 2010, 10:41pm UTC](https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550/3 "2010-11-12T22:41:36Z")

</div>

i.e. open a feature request for that 🙂

On Sat, Nov 13, 2010 at 12:41 AM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> No, there isn't currently, but can be implemented....
> 
> On Wed, Nov 10, 2010 at 7:55 PM, bernd [iberndlu@googlemail.com](mailto:iberndlu@googlemail.com) wrote:
> 
> > Hello,
> > 
> > I have indexed documents like this:
> > 
> > {  
> > "title": "Some title text here",  
> > "description": "some more text here",  
> > "object": {  
> > "c52a85d39125e6b4cdeaafb87c1ef565":"Text to be searched",  
> > "faf709ec2943202db7300bcc7eeb2930": "more text here"  
> > }  
> > }
> > 
> > When searching I would like to use the boost functionality. So queries  
> > look  
> > like this:
> > 
> > {  
> > "query": {  
> > "query\_string": {  
> > "fields":["title^3", "description^2", "object"],  
> > "query":"terms here"  
> > }  
> > }  
> > }
> > 
> > When running the example above the search is only performed in the fields  
> > "title" and "description". Is there any way to enable searching through  
> > all  
> > fields in the "object" like "object.\*"?
> > 
> > ## Best regards, Bernd
> > 
> > View this message in context:  
> > [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html)  
> > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

### Author: ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)
#### Post date: [November 12, 2010, 11:08pm UTC](https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550/4 "2010-11-12T23:08:50Z")

</div>

Hi,

what I think you can try doing in the meantime is exclude title and  
description from \_all field and update your query by adding a boolean query.  
Something like:

{ query : {  
bool : {  
should : {  
[  
{ query\_string : { fields : [title^3, description^2], query: "blah  
blah"}},  
{ query\_string : { query : "blah blah"}}  
],  
minimum\_number\_should\_match : 1  
}  
}  
}  
}

(did not try to run this query so the syntax may not be correct, but hope  
the idea is clear)

Regards,  
Lukas

On Wed, Nov 10, 2010 at 6:55 PM, bernd [iberndlu@googlemail.com](mailto:iberndlu@googlemail.com) wrote:

> Hello,
> 
> I have indexed documents like this:
> 
> {  
> "title": "Some title text here",  
> "description": "some more text here",  
> "object": {  
> "c52a85d39125e6b4cdeaafb87c1ef565":"Text to be searched",  
> "faf709ec2943202db7300bcc7eeb2930": "more text here"  
> }  
> }
> 
> When searching I would like to use the boost functionality. So queries look  
> like this:
> 
> {  
> "query": {  
> "query\_string": {  
> "fields":["title^3", "description^2", "object"],  
> "query":"terms here"  
> }  
> }  
> }
> 
> When running the example above the search is only performed in the fields  
> "title" and "description". Is there any way to enable searching through all  
> fields in the "object" like "object.\*"?
> 
> ## Best regards, Bernd
> 
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

### Author: ![bernd](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@bernd](https://discuss.elastic.co/u/bernd)
#### Post date: [November 12, 2010, 11:16pm UTC](https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550/5 "2010-11-12T23:16:36Z")

</div>

Hi,

thank you all for the answers. I've added a feature request and will try the query of Lukas meanwhile.

Regards,  
Bernd

Am 13.11.2010 um 00:09 schrieb Lukáš Vlček [via Elasticsearch Users]:

> Hi,
> 
> what I think you can try doing in the meantime is exclude title and description from \_all field and update your query by adding a boolean query. Something like:
> 
> { query : {  
> bool : {  
> should : {  
> [  
> { query\_string : { fields : [title^3, description^2], query: "blah blah"}},  
> { query\_string : { query : "blah blah"}}  
> ],  
> minimum\_number\_should\_match : 1  
> }  
> }  
> }  
> }
> 
> (did not try to run this query so the syntax may not be correct, but hope the idea is clear)
> 
> Regards,  
> Lukas
> 
> On Wed, Nov 10, 2010 at 6:55 PM, bernd \<[hidden email]\> wrote:
> 
> Hello,
> 
> I have indexed documents like this:
> 
> {  
> "title": "Some title text here",  
> "description": "some more text here",  
> "object": {  
> "c52a85d39125e6b4cdeaafb87c1ef565":"Text to be searched",  
> "faf709ec2943202db7300bcc7eeb2930": "more text here"  
> }  
> }
> 
> When searching I would like to use the boost functionality. So queries look  
> like this:
> 
> {  
> "query": {  
> "query\_string": {  
> "fields":["title^3", "description^2", "object"],  
> "query":"terms here"  
> }  
> }  
> }
> 
> When running the example above the search is only performed in the fields  
> "title" and "description". Is there any way to enable searching through all  
> fields in the "object" like "object.\*"?
> 
> ## Best regards, Bernd
> 
> View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> View message @ [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html)  
> To start a new topic under Elasticsearch Users, email [ml-node+115913-1162261748-260102@n3.nabble.com](mailto:ml-node+115913-1162261748-260102@n3.nabble.com)  
> To unsubscribe from Elasticsearch Users, click here.

---

<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: [November 13, 2010, 12:26am UTC](https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550/6 "2010-11-13T00:26:51Z")

</div>

Pushed to master:  
[Query DSL: Allow to provide pattern field names when using query\_string query · Issue #511 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/issue/511).

On Sat, Nov 13, 2010 at 1:16 AM, bernd [iberndlu@googlemail.com](mailto:iberndlu@googlemail.com) wrote:

> Hi,
> 
> thank you all for the answers. I've added a feature request and will try  
> the query of Lukas meanwhile.
> 
> Regards,  
> Bernd
> 
> Am 13.11.2010 um 00:09 schrieb Lukáš Vlček [via Elasticsearch Users]:
> 
> Hi,
> 
> what I think you can try doing in the meantime is exclude title and  
> description from \_all field and update your query by adding a boolean query.  
> Something like:
> 
> { query : {  
> bool : {  
> should : {  
> [  
> { query\_string : { fields : [title^3, description^2], query:  
> "blah blah"}},  
> { query\_string : { query : "blah blah"}}  
> ],  
> minimum\_number\_should\_match : 1  
> }  
> }  
> }  
> }
> 
> (did not try to run this query so the syntax may not be correct, but hope  
> the idea is clear)
> 
> Regards,  
> Lukas
> 
> On Wed, Nov 10, 2010 at 6:55 PM, bernd \<[hidden email]\<#12c4260843f7b033\_\>
> 
> > wrote:
> 
> > Hello,
> > 
> > I have indexed documents like this:
> > 
> > {  
> > "title": "Some title text here",  
> > "description": "some more text here",  
> > "object": {  
> > "c52a85d39125e6b4cdeaafb87c1ef565":"Text to be searched",  
> > "faf709ec2943202db7300bcc7eeb2930": "more text here"  
> > }  
> > }
> > 
> > When searching I would like to use the boost functionality. So queries  
> > look  
> > like this:
> > 
> > {  
> > "query": {  
> > "query\_string": {  
> > "fields":["title^3", "description^2", "object"],  
> > "query":"terms here"  
> > }  
> > }  
> > }
> > 
> > When running the example above the search is only performed in the fields  
> > "title" and "description". Is there any way to enable searching through  
> > all  
> > fields in the "object" like "object.\*"?
> > 
> > ## Best regards, Bernd
> > 
> > View this message in context:  
> > [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html)[http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html?by-user=t&by-user=t](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html?by-user=t&by-user=t)  
> > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com)[http://Nabble.com?by-user=t](http://Nabble.com?by-user=t)  
> > .
> 
> * * *
> 
> View message @  
> [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html)[http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html?by-user=t](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html?by-user=t)  
> To start a new topic under Elasticsearch Users, email [hidden email][http://user/SendEmail.jtp?type=node&node=1892089&i=0](http://user/SendEmail.jtp?type=node&node=1892089&i=0)  
> To unsubscribe from Elasticsearch Users, click here[http://elasticsearch-users.115913.n3.nabble.com/template/TplServlet.jtp?tpl=unsubscribe\_by\_code&node=115913&code=aWJlcm5kbHVAZ29vZ2xlbWFpbC5jb218MTE1OTEzfC03NTUxMTIwMzQ=&by-user=t](http://elasticsearch-users.115913.n3.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=115913&code=aWJlcm5kbHVAZ29vZ2xlbWFpbC5jb218MTE1OTEzfC03NTUxMTIwMzQ=&by-user=t).
> 
> * * *
> 
> View this message in context: Re: Searching a object and using fields in[http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892089.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892089.html)
> 
> Sent from the Elasticsearch Users mailing list archive[http://elasticsearch-users.115913.n3.nabble.com/](http://elasticsearch-users.115913.n3.nabble.com/)at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

### Author: ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)
#### Post date: [November 13, 2010, 12:32am UTC](https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550/7 "2010-11-13T00:32:39Z")

</div>

Oh crap! You are so fast... now I will never learn whether my idea which I  
proposed to Bernd ever worked or not... 🙂

On Sat, Nov 13, 2010 at 1:26 AM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Pushed to master:  
> [Query DSL: Allow to provide pattern field names when using query\_string query · Issue #511 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/issue/511).
> 
> On Sat, Nov 13, 2010 at 1:16 AM, bernd [iberndlu@googlemail.com](mailto:iberndlu@googlemail.com) wrote:
> 
> > Hi,
> > 
> > thank you all for the answers. I've added a feature request and will try  
> > the query of Lukas meanwhile.
> > 
> > Regards,  
> > Bernd
> > 
> > Am 13.11.2010 um 00:09 schrieb Lukáš Vlček [via Elasticsearch Users]:
> > 
> > Hi,
> > 
> > what I think you can try doing in the meantime is exclude title and  
> > description from \_all field and update your query by adding a boolean query.  
> > Something like:
> > 
> > { query : {  
> > bool : {  
> > should : {  
> > [  
> > { query\_string : { fields : [title^3, description^2], query:  
> > "blah blah"}},  
> > { query\_string : { query : "blah blah"}}  
> > ],  
> > minimum\_number\_should\_match : 1  
> > }  
> > }  
> > }  
> > }
> > 
> > (did not try to run this query so the syntax may not be correct, but hope  
> > the idea is clear)
> > 
> > Regards,  
> > Lukas
> > 
> > On Wed, Nov 10, 2010 at 6:55 PM, bernd \<[hidden email]\<#12c42a0cf9f4d625\_12c4260843f7b033\_\>
> > 
> > > wrote:
> > 
> > > Hello,
> > > 
> > > I have indexed documents like this:
> > > 
> > > {  
> > > "title": "Some title text here",  
> > > "description": "some more text here",  
> > > "object": {  
> > > "c52a85d39125e6b4cdeaafb87c1ef565":"Text to be searched",  
> > > "faf709ec2943202db7300bcc7eeb2930": "more text here"  
> > > }  
> > > }
> > > 
> > > When searching I would like to use the boost functionality. So queries  
> > > look  
> > > like this:
> > > 
> > > {  
> > > "query": {  
> > > "query\_string": {  
> > > "fields":["title^3", "description^2", "object"],  
> > > "query":"terms here"  
> > > }  
> > > }  
> > > }
> > > 
> > > When running the example above the search is only performed in the fields  
> > > "title" and "description". Is there any way to enable searching through  
> > > all  
> > > fields in the "object" like "object.\*"?
> > > 
> > > ## Best regards, Bernd
> > > 
> > > View this message in context:  
> > > [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html)[http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html?by-user=t&by-user=t](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1877605p1877605.html?by-user=t&by-user=t)  
> > > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com)[http://Nabble.com?by-user=t](http://Nabble.com?by-user=t)  
> > > .
> > 
> > * * *
> > 
> > View message @  
> > [http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html)[http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html?by-user=t](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892056.html?by-user=t)  
> > To start a new topic under Elasticsearch Users, email [hidden email][http://user/SendEmail.jtp?type=node&node=1892089&i=0](http://user/SendEmail.jtp?type=node&node=1892089&i=0)  
> > To unsubscribe from Elasticsearch Users, click here[http://elasticsearch-users.115913.n3.nabble.com/template/TplServlet.jtp?tpl=unsubscribe\_by\_code&node=115913&code=aWJlcm5kbHVAZ29vZ2xlbWFpbC5jb218MTE1OTEzfC03NTUxMTIwMzQ=&by-user=t](http://elasticsearch-users.115913.n3.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=115913&code=aWJlcm5kbHVAZ29vZ2xlbWFpbC5jb218MTE1OTEzfC03NTUxMTIwMzQ=&by-user=t).
> > 
> > * * *
> > 
> > View this message in context: Re: Searching a object and using fields in[http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892089.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-a-object-and-using-fields-in-tp1891865p1892089.html)
> > 
> > Sent from the Elasticsearch Users mailing list archive[http://elasticsearch-users.115913.n3.nabble.com/](http://elasticsearch-users.115913.n3.nabble.com/)at [Nabble.com](http://Nabble.com).

---

<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:16am UTC](https://discuss.elastic.co/t/searching-a-object-and-using-fields-in/3550/8 "2017-07-06T04:16:35Z")

</div>


