# How to limit the fields of response when I search a keyword?

**URL:** <https://discuss.elastic.co/t/how-to-limit-the-fields-of-response-when-i-search-a-keyword/18485>\
**Category:** Elasticsearch\
**Created:** [July 5, 2014, 9:32am UTC](https://discuss.elastic.co/t/how-to-limit-the-fields-of-response-when-i-search-a-keyword/18485 "2014-07-05T09:32:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![11158](https://avatars.discourse-cdn.com/v4/letter/1/d9b06d/32.png) [@11158](https://discuss.elastic.co/u/11158)\
**Post date:** [July 5, 2014, 9:32am UTC](https://discuss.elastic.co/t/how-to-limit-the-fields-of-response-when-i-search-a-keyword/18485/1 "2014-07-05T09:32:00Z")

</div>

Dear all:

I have a reasonable need, but I can't find how to deal with it on es  
official docs and books, is anyone know, please teach it to me! thank you!

I have a large set of docs, which hold a lot of fields, such as:

uid2 = {  
"id": 1404999597,  
"idstr": "1404999597",  
"class": 1,  
"screen\_name": "",  
"name": "",  
"province": "11",  
"city": "1000",  
"location": "北京",  
"description": "在主流与非主流之间徘徊",  
"url": "",  
"profile\_image\_url": "http://tp2.sinaimg.cn/1404999597/50/5642385629/0",  
"profile\_url": "u/1404999597",  
"domain": "",  
"weihao": "",  
"gender": "f",  
"followers\_count": 1030710,  
"friends\_count": 272,  
"statuses\_count": 1519,  
"favourites\_count": 90,  
"created\_at": "Wed Mar 23 23:59:40 +0800 2011",  
"following": false,  
"allow\_all\_act\_msg": false,  
"geo\_enabled": false,  
"verified": true,  
"verified\_type": 0,  
"remark": "",  
"status": {  
"created\_at": "Tue Jul 01 13:17:55 +0800 2014",  
"id": 3727513249206064,  
"mid": "3727513249206064",  
"idstr": "3727513249206064",  
"text": "听到她的声音，我更相信她和荷西在天堂，依旧幸福着。 //@东方尔雅:现在这种纯真的爱情还好找吗？ //@晓玲-有话说:[心]",  
"source": "\<a href="http://app.weibo.com/t/feed/9ksdit"  
rel="nofollow"\>iPhone客户端",  
"favorited": false,  
"truncated": false,  
"in\_reply\_to\_status\_id": "",  
"in\_reply\_to\_user\_id": "",  
"in\_reply\_to\_screen\_name": "",  
"pic\_urls": [],  
"geo": null,  
"reposts\_count": 0,  
"comments\_count": 0,  
"attitudes\_count": 0,  
"mlevel": 0,  
"visible": {  
"type": 0,  
"list\_id": 0  
},  
"darwin\_tags": []  
},  
"ptype": 1,  
"allow\_all\_comment": true,  
"avatar\_large": "[http://tp2.sinaimg.cn/1404999597/180/5642385629/0](http://tp2.sinaimg.cn/1404999597/180/5642385629/0)",  
"avatar\_hd": "[http://tp2.sinaimg.cn/1404999597/180/5642385629/0](http://tp2.sinaimg.cn/1404999597/180/5642385629/0)",  
"verified\_reason": "电视台主持人梦桐",  
"verified\_trade": "",  
"verified\_reason\_url": "",  
"verified\_source": "",  
"verified\_source\_url": "",  
"follow\_me": false,  
"online\_status": 0,  
"bi\_followers\_count": 167,  
"lang": "zh-cn",  
"star": 0,  
"mbtype": 0,  
"mbrank": 0,  
"block\_word": 0,  
"block\_app": 0,  
"ability\_tags": "主持人",  
"worldcup\_guess": 0  
}

this is a user info. If I want analysis the gender distribution of all of  
users whose live in "city": "1000"(1000 is a city code), I don't need other  
field except "city" and "gender", How can I exclude these meaningless field  
before they are returned. Because there are a lots of doc, If transmit the  
entire doc will wast many time and bandwidth, and I have to trim the  
additional information in myself program. so, is there a method can deal  
with problem for me? thank you.

--  
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/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [July 7, 2014, 9:47pm UTC](https://discuss.elastic.co/t/how-to-limit-the-fields-of-response-when-i-search-a-keyword/18485/2 "2014-07-07T21:47:25Z")

</div>

I responded differently to your other similar question, but you can also  
limit the fields, but explicitly asking for the set that you want:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Cheers,

Ivan

On Sat, Jul 5, 2014 at 2:32 AM, 纪路 [magievanerv@gmail.com](mailto:magievanerv@gmail.com) wrote:

> Dear all:
> 
> I have a reasonable need, but I can't find how to deal with it on es  
> official docs and books, is anyone know, please teach it to me! thank you!
> 
> I have a large set of docs, which hold a lot of fields, such as:
> 
> uid2 = {  
> "id": 1404999597,  
> "idstr": "1404999597",  
> "class": 1,  
> "screen\_name": "",  
> "name": "",  
> "province": "11",  
> "city": "1000",  
> "location": "北京",  
> "description": "在主流与非主流之间徘徊",  
> "url": "",  
> "profile\_image\_url": "[http://tp2.sinaimg.cn/1404999597/50/5642385629/0](http://tp2.sinaimg.cn/1404999597/50/5642385629/0)",  
> "profile\_url": "u/1404999597",  
> "domain": "",  
> "weihao": "",  
> "gender": "f",  
> "followers\_count": 1030710,  
> "friends\_count": 272,  
> "statuses\_count": 1519,  
> "favourites\_count": 90,  
> "created\_at": "Wed Mar 23 23:59:40 +0800 2011",  
> "following": false,  
> "allow\_all\_act\_msg": false,  
> "geo\_enabled": false,  
> "verified": true,  
> "verified\_type": 0,  
> "remark": "",  
> "status": {  
> "created\_at": "Tue Jul 01 13:17:55 +0800 2014",  
> "id": 3727513249206064,  
> "mid": "3727513249206064",  
> "idstr": "3727513249206064",  
> "text": "听到她的声音，我更相信她和荷西在天堂，依旧幸福着。 //@东方尔雅:现在这种纯真的爱情还好找吗？ //@晓玲-有话说:[心]",  
> "source": "\<a href="[http://app.weibo.com/t/feed/9ksdit\](http://app.weibo.com/t/feed/9ksdit%5C)"  
> rel="nofollow"\>iPhone客户端",  
> "favorited": false,  
> "truncated": false,  
> "in\_reply\_to\_status\_id": "",  
> "in\_reply\_to\_user\_id": "",  
> "in\_reply\_to\_screen\_name": "",  
> "pic\_urls": ,  
> "geo": null,  
> "reposts\_count": 0,  
> "comments\_count": 0,  
> "attitudes\_count": 0,  
> "mlevel": 0,  
> "visible": {  
> "type": 0,  
> "list\_id": 0  
> },  
> "darwin\_tags":   
> },  
> "ptype": 1,  
> "allow\_all\_comment": true,  
> "avatar\_large": "[http://tp2.sinaimg.cn/1404999597/180/5642385629/0](http://tp2.sinaimg.cn/1404999597/180/5642385629/0)",  
> "avatar\_hd": "[http://tp2.sinaimg.cn/1404999597/180/5642385629/0](http://tp2.sinaimg.cn/1404999597/180/5642385629/0)",  
> "verified\_reason": "电视台主持人梦桐",  
> "verified\_trade": "",  
> "verified\_reason\_url": "",  
> "verified\_source": "",  
> "verified\_source\_url": "",  
> "follow\_me": false,  
> "online\_status": 0,  
> "bi\_followers\_count": 167,  
> "lang": "zh-cn",  
> "star": 0,  
> "mbtype": 0,  
> "mbrank": 0,  
> "block\_word": 0,  
> "block\_app": 0,  
> "ability\_tags": "主持人",  
> "worldcup\_guess": 0  
> }
> 
> this is a user info. If I want analysis the gender distribution of all of  
> users whose live in "city": "1000"(1000 is a city code), I don't need other  
> field except "city" and "gender", How can I exclude these meaningless field  
> before they are returned. Because there are a lots of doc, If transmit the  
> entire doc will wast many time and bandwidth, and I have to trim the  
> additional information in myself program. so, is there a method can deal  
> with problem for me? thank you.
> 
> --  
> 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/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CALY%3DcQAF8fXiSFhpGiP31RiwpgPbwMrwszv\_8chDGqopkXqyWQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAF8fXiSFhpGiP31RiwpgPbwMrwszv_8chDGqopkXqyWQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![11158](https://avatars.discourse-cdn.com/v4/letter/1/d9b06d/32.png) [@11158](https://discuss.elastic.co/u/11158)\
**Post date:** [July 8, 2014, 9:20am UTC](https://discuss.elastic.co/t/how-to-limit-the-fields-of-response-when-i-search-a-keyword/18485/3 "2014-07-08T09:20:03Z")

</div>

Dear Ivan:

Thank for your answer, I have already deal with this problem according to  
your previous answer. This post is a little queer!!! I surely wrote this  
post, but after it posted, it disappeared immediately. I believed my  
network should result this problem firstly, because I live in China, where  
Google's service can't convenient arrived. I am so grateful to you for your  
guidance, and I'm so sorry for this problem, it never happened again.

by Magigo

在 2014年7月8日星期二UTC+8上午5时47分34秒，Ivan Brusic写道：

> I responded differently to your other similar question, but you can also  
> limit the fields, but explicitly asking for the set that you want:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html)
> 
> Cheers,
> 
> Ivan
> 
> On Sat, Jul 5, 2014 at 2:32 AM, 纪路 \<[magie...@gmail.com](mailto:magie...@gmail.com) \<javascript:\>\>  
> wrote:
> 
> > Dear all:
> > 
> > I have a reasonable need, but I can't find how to deal with it on es  
> > official docs and books, is anyone know, please teach it to me! thank you!
> > 
> > I have a large set of docs, which hold a lot of fields, such as:
> > 
> > uid2 = {  
> > "id": 1404999597,  
> > "idstr": "1404999597",  
> > "class": 1,  
> > "screen\_name": "",  
> > "name": "",  
> > "province": "11",  
> > "city": "1000",  
> > "location": "北京",  
> > "description": "在主流与非主流之间徘徊",  
> > "url": "",  
> > "profile\_image\_url": "[http://tp2.sinaimg.cn/1404999597/50/5642385629/0](http://tp2.sinaimg.cn/1404999597/50/5642385629/0)",  
> > "profile\_url": "u/1404999597",  
> > "domain": "",  
> > "weihao": "",  
> > "gender": "f",  
> > "followers\_count": 1030710,  
> > "friends\_count": 272,  
> > "statuses\_count": 1519,  
> > "favourites\_count": 90,  
> > "created\_at": "Wed Mar 23 23:59:40 +0800 2011",  
> > "following": false,  
> > "allow\_all\_act\_msg": false,  
> > "geo\_enabled": false,  
> > "verified": true,  
> > "verified\_type": 0,  
> > "remark": "",  
> > "status": {  
> > "created\_at": "Tue Jul 01 13:17:55 +0800 2014",  
> > "id": 3727513249206064,  
> > "mid": "3727513249206064",  
> > "idstr": "3727513249206064",  
> > "text": "听到她的声音，我更相信她和荷西在天堂，依旧幸福着。 //@东方尔雅:现在这种纯真的爱情还好找吗？ //@晓玲-有话说:[心]",  
> > "source": "\<a href="[http://app.weibo.com/t/feed/9ksdit\](http://app.weibo.com/t/feed/9ksdit%5C)"  
> > rel="nofollow"\>iPhone客户端",  
> > "favorited": false,  
> > "truncated": false,  
> > "in\_reply\_to\_status\_id": "",  
> > "in\_reply\_to\_user\_id": "",  
> > "in\_reply\_to\_screen\_name": "",  
> > "pic\_urls": ,  
> > "geo": null,  
> > "reposts\_count": 0,  
> > "comments\_count": 0,  
> > "attitudes\_count": 0,  
> > "mlevel": 0,  
> > "visible": {  
> > "type": 0,  
> > "list\_id": 0  
> > },  
> > "darwin\_tags":   
> > },  
> > "ptype": 1,  
> > "allow\_all\_comment": true,  
> > "avatar\_large": "[http://tp2.sinaimg.cn/1404999597/180/5642385629/0](http://tp2.sinaimg.cn/1404999597/180/5642385629/0)",  
> > "avatar\_hd": "[http://tp2.sinaimg.cn/1404999597/180/5642385629/0](http://tp2.sinaimg.cn/1404999597/180/5642385629/0)",  
> > "verified\_reason": "电视台主持人梦桐",  
> > "verified\_trade": "",  
> > "verified\_reason\_url": "",  
> > "verified\_source": "",  
> > "verified\_source\_url": "",  
> > "follow\_me": false,  
> > "online\_status": 0,  
> > "bi\_followers\_count": 167,  
> > "lang": "zh-cn",  
> > "star": 0,  
> > "mbtype": 0,  
> > "mbrank": 0,  
> > "block\_word": 0,  
> > "block\_app": 0,  
> > "ability\_tags": "主持人",  
> > "worldcup\_guess": 0  
> > }
> > 
> > this is a user info. If I want analysis the gender distribution of all  
> > of users whose live in "city": "1000"(1000 is a city code), I don't need  
> > other field except "city" and "gender", How can I exclude these meaningless  
> > field before they are returned. Because there are a lots of doc, If  
> > transmit the entire doc will wast many time and bandwidth, and I have to  
> > trim the additional information in myself program. so, is there a method  
> > can deal with problem for me? thank you.
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/e04431ff-b611-4a3d-83ba-a2d7aed0a29f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e04431ff-b611-4a3d-83ba-a2d7aed0a29f%40googlegroups.com).  
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, 1:17am UTC](https://discuss.elastic.co/t/how-to-limit-the-fields-of-response-when-i-search-a-keyword/18485/4 "2017-07-06T01:17:21Z")

</div>


