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


(纪路) #1

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",
"avatar_hd": "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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0f79f408-92d4-4806-8c47-02dd877ddaaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Ivan Brusic) #2

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

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-fields.html

Cheers,

Ivan

On Sat, Jul 5, 2014 at 2:32 AM, 纪路 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",
"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",
"avatar_hd": "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.
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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAF8fXiSFhpGiP31RiwpgPbwMrwszv_8chDGqopkXqyWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(纪路) #3

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:

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 <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",
"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",
"avatar_hd": "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 <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?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e04431ff-b611-4a3d-83ba-a2d7aed0a29f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4