# Querying specific fields in multiple mappings

**URL:** <https://discuss.elastic.co/t/querying-specific-fields-in-multiple-mappings/6005>\
**Category:** Elasticsearch\
**Created:** [November 29, 2011, 9:53am UTC](https://discuss.elastic.co/t/querying-specific-fields-in-multiple-mappings/6005 "2011-11-29T09:53:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arien](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@arien](https://discuss.elastic.co/u/arien)\
**Post date:** [November 29, 2011, 9:53am UTC](https://discuss.elastic.co/t/querying-specific-fields-in-multiple-mappings/6005/1 "2011-11-29T09:53:24Z")

</div>

Hi all;  
I have some questions when it comes to querying specific fields in  
multiple mappings provided that all mappings belongs to same index.say  
"test" is the mapping and "testmap1","testmap2","testmap3" are the  
mappings of an index.  
In query i dont want to specify any mapping name just simply wants to  
put searchable columns there.  
And the second thing; is it possible to register mapping specific  
query against particular index,if so please provide some inputs.

Thanks;  
Arien

---

<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 29, 2011, 4:36pm UTC](https://discuss.elastic.co/t/querying-specific-fields-in-multiple-mappings/6005/2 "2011-11-29T16:36:07Z")

</div>

I did not understand the question properly... . You can specify  
"field\_name", but you can also specify "type1.field\_name", which will  
automatically wrap the query to be filtered by the type.

On Tue, Nov 29, 2011 at 11:53 AM, arien [ajaypadvi@gmail.com](mailto:ajaypadvi@gmail.com) wrote:

> Hi all;  
> I have some questions when it comes to querying specific fields in  
> multiple mappings provided that all mappings belongs to same index.say  
> "test" is the mapping and "testmap1","testmap2","testmap3" are the  
> mappings of an index.  
> In query i dont want to specify any mapping name just simply wants to  
> put searchable columns there.  
> And the second thing; is it possible to register mapping specific  
> query against particular index,if so please provide some inputs.
> 
> Thanks;  
> Arien

---

<div class="post-metadata">

**Author:** ![arien](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@arien](https://discuss.elastic.co/u/arien)\
**Post date:** [November 30, 2011, 11:26am UTC](https://discuss.elastic.co/t/querying-specific-fields-in-multiple-mappings/6005/3 "2011-11-30T11:26:12Z")

</div>

# Hi shay, Sorry for that i didn't frame my questions correctly. In order the elaborate the scenario lets say i have an index "index" with two mappings "mapping1","mapping2" and following are the records in those;

# curl -XPUT '[http://localhost:9200/index/mapping1/1](http://localhost:9200/index/mapping1/1)' -d '{ "user" : "kim", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping1/2](http://localhost:9200/index/mapping1/2)' -d '{ "user" : "ajay", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping1/3](http://localhost:9200/index/mapping1/3)' -d '{ "user" : "bhavani", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }'

# curl -XPUT '[http://localhost:9200/index/mapping2/1](http://localhost:9200/index/mapping2/1)' -d '{ "id" : "kim", "think" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping2/2](http://localhost:9200/index/mapping2/2)' -d '{ "id" : "kim", "think" : "2009-11-15T14:12:12" }' curl -XPUT '[http://localhost:9200/index/mapping2/3](http://localhost:9200/index/mapping2/3)' -d '{ "id" : "kim", "think" : "2009-11-15T14:12:12" }'

and if i Search using query

curl "localhost:9200/index/\_search?pretty=true" -d '{  
"fields" : ["mapping1.user","mapping2.think"],  
"query": {  
"query\_string": {  
"query": "kim"  
}  
}  
}'

I am getting following results

{  
"took" : 9,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 4,  
"max\_score" : 0.26516503,  
"hits" : [ {  
"\_index" : "index",  
"\_type" : "mapping2",  
"\_id" : "2",  
"\_score" : 0.26516503,  
"fields" : {  
"mapping1.user" : null,  
"mapping2.think" : "2009-11-15T14:12:12"  
}  
}, {  
"\_index" : "index",  
"\_type" : "mapping2",  
"\_id" : "3",  
"\_score" : 0.26516503,  
"fields" : {  
"mapping1.user" : null,  
"mapping2.think" : "2009-11-15T14:12:12"  
}  
}, {  
"\_index" : "index",  
"\_type" : "mapping2",  
"\_id" : "1",  
"\_score" : 0.18392482,  
"fields" : {  
"mapping1.user" : null,  
"mapping2.think" : "trying out Elastic Search"  
}  
}, {  
"\_index" : "index",  
"\_type" : "mapping1",  
"\_id" : "1",  
"\_score" : 0.13137488,  
"fields" : {  
"mapping1.user" : "kim",  
"mapping2.think" : null  
}  
} ]  
}  
}

As you can see in above results i've got 4 results out of which only  
one i wanted where "mapping1.user" : "kim" is actually  
present.Instead i am receiving all records from mapping2 also where it  
doesn't find "user" field and giving me records for "mapping1.user" :  
null.  
Solution for that can be to use filters while querying.But my mappings  
are containing huge number of columns and also in an index there are  
considerably large number of mappings present.  
So my questions is now;Whatever be the fields i have mentioned in  
"fields" array while querying .query\_string should only take those  
fields and fire on only those records having fields specified in an  
array without filters.  
Sorry for such long description.I hope it will be helpful in case.  
Thanks;  
Arien

On Nov 29, 9:36 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> I did not understand the question properly... . You can specify  
> "field\_name", but you can also specify "type1.field\_name", which will  
> automatically wrap the query to be filtered by the type.
> 
> On Tue, Nov 29, 2011 at 11:53 AM, arien [ajaypa...@gmail.com](mailto:ajaypa...@gmail.com) wrote:
> 
> > Hi all;  
> > I have some questions when it comes to querying specific fields in  
> > multiple mappings provided that all mappings belongs to same index.say  
> > "test" is the mapping and "testmap1","testmap2","testmap3" are the  
> > mappings of an index.  
> > In query i dont want to specify any mapping name just simply wants to  
> > put searchable columns there.  
> > And the second thing; is it possible to register mapping specific  
> > query against particular index,if so please provide some inputs.
> 
> > Thanks;  
> > Arien

---

<div class="post-metadata">

**Author:** ![Michael\_Sick](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Michael\_Sick](https://discuss.elastic.co/u/Michael_Sick)\
**Post date:** [November 30, 2011, 1:05pm UTC](https://discuss.elastic.co/t/querying-specific-fields-in-multiple-mappings/6005/4 "2011-11-30T13:05:29Z")

</div>

Arien,

If I read your example/question right, believe you just want to use the  
TermQuery:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/term-query.html)

Or TermFilter  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/term-filter.html)

For Query vs. Filter, you'll have to think about the memory/perf tradeoffs.

On Wed, Nov 30, 2011 at 6:26 AM, arien [ajaypadvi@gmail.com](mailto:ajaypadvi@gmail.com) wrote:

> # Hi shay, Sorry for that i didn't frame my questions correctly. In order the elaborate the scenario lets say i have an index "index" with two mappings "mapping1","mapping2" and following are the records in those;
> 
> # curl -XPUT '[http://localhost:9200/index/mapping1/1](http://localhost:9200/index/mapping1/1)' -d '{ "user" : "kim", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping1/2](http://localhost:9200/index/mapping1/2)' -d '{ "user" : "ajay", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping1/3](http://localhost:9200/index/mapping1/3)' -d '{ "user" : "bhavani", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }'
> 
> # curl -XPUT '[http://localhost:9200/index/mapping2/1](http://localhost:9200/index/mapping2/1)' -d '{ "id" : "kim", "think" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping2/2](http://localhost:9200/index/mapping2/2)' -d '{ "id" : "kim", "think" : "2009-11-15T14:12:12" }' curl -XPUT '[http://localhost:9200/index/mapping2/3](http://localhost:9200/index/mapping2/3)' -d '{ "id" : "kim", "think" : "2009-11-15T14:12:12" }'
> 
> and if i Search using query
> 
> curl "localhost:9200/index/\_search?pretty=true" -d '{  
> "fields" : ["mapping1.user","mapping2.think"],  
> "query": {  
> "query\_string": {  
> "query": "kim"  
> }  
> }  
> }'
> 
> I am getting following results
> 
> {  
> "took" : 9,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 4,  
> "max\_score" : 0.26516503,  
> "hits" : [ {  
> "\_index" : "index",  
> "\_type" : "mapping2",  
> "\_id" : "2",  
> "\_score" : 0.26516503,  
> "fields" : {  
> "mapping1.user" : null,  
> "mapping2.think" : "2009-11-15T14:12:12"  
> }  
> }, {  
> "\_index" : "index",  
> "\_type" : "mapping2",  
> "\_id" : "3",  
> "\_score" : 0.26516503,  
> "fields" : {  
> "mapping1.user" : null,  
> "mapping2.think" : "2009-11-15T14:12:12"  
> }  
> }, {  
> "\_index" : "index",  
> "\_type" : "mapping2",  
> "\_id" : "1",  
> "\_score" : 0.18392482,  
> "fields" : {  
> "mapping1.user" : null,  
> "mapping2.think" : "trying out Elastic Search"  
> }  
> }, {  
> "\_index" : "index",  
> "\_type" : "mapping1",  
> "\_id" : "1",  
> "\_score" : 0.13137488,  
> "fields" : {  
> "mapping1.user" : "kim",  
> "mapping2.think" : null  
> }  
> } ]  
> }  
> }
> 
> As you can see in above results i've got 4 results out of which only  
> one i wanted where "mapping1.user" : "kim" is actually  
> present.Instead i am receiving all records from mapping2 also where it  
> doesn't find "user" field and giving me records for "mapping1.user" :  
> null.  
> Solution for that can be to use filters while querying.But my mappings  
> are containing huge number of columns and also in an index there are  
> considerably large number of mappings present.  
> So my questions is now;Whatever be the fields i have mentioned in  
> "fields" array while querying .query\_string should only take those  
> fields and fire on only those records having fields specified in an  
> array without filters.  
> Sorry for such long description.I hope it will be helpful in case.  
> Thanks;  
> Arien
> 
> On Nov 29, 9:36 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > I did not understand the question properly... . You can specify  
> > "field\_name", but you can also specify "type1.field\_name", which will  
> > automatically wrap the query to be filtered by the type.
> > 
> > On Tue, Nov 29, 2011 at 11:53 AM, arien [ajaypa...@gmail.com](mailto:ajaypa...@gmail.com) wrote:
> > 
> > > Hi all;  
> > > I have some questions when it comes to querying specific fields in  
> > > multiple mappings provided that all mappings belongs to same index.say  
> > > "test" is the mapping and "testmap1","testmap2","testmap3" are the  
> > > mappings of an index.  
> > > In query i dont want to specify any mapping name just simply wants to  
> > > put searchable columns there.  
> > > And the second thing; is it possible to register mapping specific  
> > > query against particular index,if so please provide some inputs.
> > 
> > > Thanks;  
> > > Arien

---

<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 30, 2011, 3:19pm UTC](https://discuss.elastic.co/t/querying-specific-fields-in-multiple-mappings/6005/5 "2011-11-30T15:19:17Z")

</div>

You get the results because query\_string will execute by default against  
the \_all field, unless you specify custom fields to search on. Note, you  
might be confusing things and think that the top level fields (the ones you  
provide on the same level as "query") will contraint the query to execute  
on it, but thats not what they do, they control which fields will be  
returned from the response. You need to put the fields in the query\_string  
element to control which fields the query\_string will execute.

On Wed, Nov 30, 2011 at 1:26 PM, arien [ajaypadvi@gmail.com](mailto:ajaypadvi@gmail.com) wrote:

> # Hi shay, Sorry for that i didn't frame my questions correctly. In order the elaborate the scenario lets say i have an index "index" with two mappings "mapping1","mapping2" and following are the records in those;
> 
> # curl -XPUT '[http://localhost:9200/index/mapping1/1](http://localhost:9200/index/mapping1/1)' -d '{ "user" : "kim", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping1/2](http://localhost:9200/index/mapping1/2)' -d '{ "user" : "ajay", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping1/3](http://localhost:9200/index/mapping1/3)' -d '{ "user" : "bhavani", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }'
> 
> # curl -XPUT '[http://localhost:9200/index/mapping2/1](http://localhost:9200/index/mapping2/1)' -d '{ "id" : "kim", "think" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping2/2](http://localhost:9200/index/mapping2/2)' -d '{ "id" : "kim", "think" : "2009-11-15T14:12:12" }' curl -XPUT '[http://localhost:9200/index/mapping2/3](http://localhost:9200/index/mapping2/3)' -d '{ "id" : "kim", "think" : "2009-11-15T14:12:12" }'
> 
> and if i Search using query
> 
> curl "localhost:9200/index/\_search?pretty=true" -d '{  
> "fields" : ["mapping1.user","mapping2.think"],  
> "query": {  
> "query\_string": {  
> "query": "kim"  
> }  
> }  
> }'
> 
> I am getting following results
> 
> {  
> "took" : 9,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 4,  
> "max\_score" : 0.26516503,  
> "hits" : [ {  
> "\_index" : "index",  
> "\_type" : "mapping2",  
> "\_id" : "2",  
> "\_score" : 0.26516503,  
> "fields" : {  
> "mapping1.user" : null,  
> "mapping2.think" : "2009-11-15T14:12:12"  
> }  
> }, {  
> "\_index" : "index",  
> "\_type" : "mapping2",  
> "\_id" : "3",  
> "\_score" : 0.26516503,  
> "fields" : {  
> "mapping1.user" : null,  
> "mapping2.think" : "2009-11-15T14:12:12"  
> }  
> }, {  
> "\_index" : "index",  
> "\_type" : "mapping2",  
> "\_id" : "1",  
> "\_score" : 0.18392482,  
> "fields" : {  
> "mapping1.user" : null,  
> "mapping2.think" : "trying out Elastic Search"  
> }  
> }, {  
> "\_index" : "index",  
> "\_type" : "mapping1",  
> "\_id" : "1",  
> "\_score" : 0.13137488,  
> "fields" : {  
> "mapping1.user" : "kim",  
> "mapping2.think" : null  
> }  
> } ]  
> }  
> }
> 
> As you can see in above results i've got 4 results out of which only  
> one i wanted where "mapping1.user" : "kim" is actually  
> present.Instead i am receiving all records from mapping2 also where it  
> doesn't find "user" field and giving me records for "mapping1.user" :  
> null.  
> Solution for that can be to use filters while querying.But my mappings  
> are containing huge number of columns and also in an index there are  
> considerably large number of mappings present.  
> So my questions is now;Whatever be the fields i have mentioned in  
> "fields" array while querying .query\_string should only take those  
> fields and fire on only those records having fields specified in an  
> array without filters.  
> Sorry for such long description.I hope it will be helpful in case.  
> Thanks;  
> Arien
> 
> On Nov 29, 9:36 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > I did not understand the question properly... . You can specify  
> > "field\_name", but you can also specify "type1.field\_name", which will  
> > automatically wrap the query to be filtered by the type.
> > 
> > On Tue, Nov 29, 2011 at 11:53 AM, arien [ajaypa...@gmail.com](mailto:ajaypa...@gmail.com) wrote:
> > 
> > > Hi all;  
> > > I have some questions when it comes to querying specific fields in  
> > > multiple mappings provided that all mappings belongs to same index.say  
> > > "test" is the mapping and "testmap1","testmap2","testmap3" are the  
> > > mappings of an index.  
> > > In query i dont want to specify any mapping name just simply wants to  
> > > put searchable columns there.  
> > > And the second thing; is it possible to register mapping specific  
> > > query against particular index,if so please provide some inputs.
> > 
> > > Thanks;  
> > > Arien

---

<div class="post-metadata">

**Author:** ![arien](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@arien](https://discuss.elastic.co/u/arien)\
**Post date:** [December 1, 2011, 9:24am UTC](https://discuss.elastic.co/t/querying-specific-fields-in-multiple-mappings/6005/6 "2011-12-01T09:24:10Z")

</div>

Hi;  
Thanks for your inputs,  
Accordingly i've framed my query like;

curl -XGET "[http://localhost:9200/index/\_search?pretty=true](http://localhost:9200/index/_search?pretty=true)" -d '{  
"fields": [  
"mapping1.user",  
"mapping2.think"  
],  
"query": {  
"query\_string": {  
"fields": [  
"mapping1.user",  
"mapping2.think"  
],  
"query": "kim"  
}  
}  
}'

which is returning me wanted results;

{  
"took" : 11,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 0.5906161,  
"hits" : [ {  
"\_index" : "index",  
"\_type" : "mapping1",  
"\_id" : "1",  
"\_score" : 0.5906161,  
"fields" : {  
"mapping1.user" : "kim",  
"mapping2.think" : null  
}  
} ]  
}

As you can see I have specified an array of fields in query\_string to  
control on which fields the query\_string will execute.  
Is this possible in the case of "textquery" where one can specify same  
array to controlling searchable fields without making use of  
filters??..

Thanking you all;  
arien

On Nov 30, 8:19 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> You get the results because query\_string will execute by default against  
> the \_all field, unless you specify custom fields to search on. Note, you  
> might be confusing things and think that the top level fields (the ones you  
> provide on the same level as "query") will contraint the query to execute  
> on it, but thats not what they do, they control which fields will be  
> returned from the response. You need to put the fields in the query\_string  
> element to control which fields the query\_string will execute.
> 
> On Wed, Nov 30, 2011 at 1:26 PM, arien [ajaypa...@gmail.com](mailto:ajaypa...@gmail.com) wrote:
> 
> > # Hi shay, Sorry for that i didn't frame my questions correctly. In order the elaborate the scenario lets say i have an index "index" with two mappings "mapping1","mapping2" and following are the records in those;
> > 
> > # curl -XPUT '[http://localhost:9200/index/mapping1/1'-d](http://localhost:9200/index/mapping1/1'-d) '{ "user" : "kim", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping1/2'-d](http://localhost:9200/index/mapping1/2'-d) '{ "user" : "ajay", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping1/3'-d](http://localhost:9200/index/mapping1/3'-d) '{ "user" : "bhavani", "post" : "2009-11-15T14:12:12", "message" : "trying out Elastic Search" }'
> > 
> > # curl -XPUT '[http://localhost:9200/index/mapping2/1'-d](http://localhost:9200/index/mapping2/1'-d) '{ "id" : "kim", "think" : "trying out Elastic Search" }' curl -XPUT '[http://localhost:9200/index/mapping2/2'-d](http://localhost:9200/index/mapping2/2'-d) '{ "id" : "kim", "think" : "2009-11-15T14:12:12" }' curl -XPUT '[http://localhost:9200/index/mapping2/3'-d](http://localhost:9200/index/mapping2/3'-d) '{ "id" : "kim", "think" : "2009-11-15T14:12:12" }'
> > 
> > and if i Search using query
> 
> > curl "localhost:9200/index/\_search?pretty=true" -d '{  
> > "fields" : ["mapping1.user","mapping2.think"],  
> > "query": {  
> > "query\_string": {  
> > "query": "kim"  
> > }  
> > }  
> > }'
> 
> > I am getting following results
> 
> > {  
> > "took" : 9,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 4,  
> > "max\_score" : 0.26516503,  
> > "hits" : [ {  
> > "\_index" : "index",  
> > "\_type" : "mapping2",  
> > "\_id" : "2",  
> > "\_score" : 0.26516503,  
> > "fields" : {  
> > "mapping1.user" : null,  
> > "mapping2.think" : "2009-11-15T14:12:12"  
> > }  
> > }, {  
> > "\_index" : "index",  
> > "\_type" : "mapping2",  
> > "\_id" : "3",  
> > "\_score" : 0.26516503,  
> > "fields" : {  
> > "mapping1.user" : null,  
> > "mapping2.think" : "2009-11-15T14:12:12"  
> > }  
> > }, {  
> > "\_index" : "index",  
> > "\_type" : "mapping2",  
> > "\_id" : "1",  
> > "\_score" : 0.18392482,  
> > "fields" : {  
> > "mapping1.user" : null,  
> > "mapping2.think" : "trying out Elastic Search"  
> > }  
> > }, {  
> > "\_index" : "index",  
> > "\_type" : "mapping1",  
> > "\_id" : "1",  
> > "\_score" : 0.13137488,  
> > "fields" : {  
> > "mapping1.user" : "kim",  
> > "mapping2.think" : null  
> > }  
> > } ]  
> > }  
> > }
> 
> > As you can see in above results i've got 4 results out of which only  
> > one i wanted where "mapping1.user" : "kim" is actually  
> > present.Instead i am receiving all records from mapping2 also where it  
> > doesn't find "user" field and giving me records for "mapping1.user" :  
> > null.  
> > Solution for that can be to use filters while querying.But my mappings  
> > are containing huge number of columns and also in an index there are  
> > considerably large number of mappings present.  
> > So my questions is now;Whatever be the fields i have mentioned in  
> > "fields" array while querying .query\_string should only take those  
> > fields and fire on only those records having fields specified in an  
> > array without filters.  
> > Sorry for such long description.I hope it will be helpful in case.  
> > Thanks;  
> > Arien
> 
> > On Nov 29, 9:36 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > I did not understand the question properly... . You can specify  
> > > "field\_name", but you can also specify "type1.field\_name", which will  
> > > automatically wrap the query to be filtered by the type.
> 
> > > On Tue, Nov 29, 2011 at 11:53 AM, arien [ajaypa...@gmail.com](mailto:ajaypa...@gmail.com) wrote:
> > > 
> > > > Hi all;  
> > > > I have some questions when it comes to querying specific fields in  
> > > > multiple mappings provided that all mappings belongs to same index.say  
> > > > "test" is the mapping and "testmap1","testmap2","testmap3" are the  
> > > > mappings of an index.  
> > > > In query i dont want to specify any mapping name just simply wants to  
> > > > put searchable columns there.  
> > > > And the second thing; is it possible to register mapping specific  
> > > > query against particular index,if so please provide some inputs.
> 
> > > > Thanks;  
> > > > Arien

---

<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, 3:46am UTC](https://discuss.elastic.co/t/querying-specific-fields-in-multiple-mappings/6005/7 "2017-07-06T03:46:49Z")

</div>


