通过自定义ID从elasticsearch中的tweet id搜索推文

时间:2017-05-23 13:52:06

标签: elasticsearch kibana

我一直在尝试通过Kibana中的自定义ID搜索特定的推文,我的elasticsearch repo具有多个帐户的时间轴json。我已经尝试了这么多格式,但无法得到它。

GET twitter/tweet/_search
{
   "query":{
      "term":{"id":"850330838709489700"}
   }
}

以下是文档样本。

{
        "_index": "twitter",
        "_type": "tweet",
        "_id": "AVwvzcZROQ98HXQdQAPR",
        "_score": 0,
        "_source": {
          "contributors": null,
          "truncated": false,
          "text": """"@zee_alam: Jiyoo. https://.../5qojZMzt4t" 
Don't mind but this is bullshit """,
          "is_quote_status": false,
          "in_reply_to_status_id": 833583764513181700,
          "id": 833609664973635600,
          "favorite_count": 1,
          "source": """<a href="http://www.twitter.com" rel="nofollow">Twitter for Windows Phone</a>""",
          "retweeted": false,
          "coordinates": {
            "type": "Point",
            "coordinates": [
              73.07080201,
              33.64006041
            ]
          },
          "entities": {
            "symbols": [],
            "user_mentions": [
              {
                "id": 263167083,
                "indices": [
                  1,
                  10
                ],
                "id_str": "263167083",
                "screen_name": "zee_alam",
                "name": "Zee Shan Alam"
              }
            ],
            "hashtags": [],
            "urls": [
              {
                "url": "https://xxxxqojZMzt4t",
                "indices": [
                  19,
                  42
                ],
                "expanded_url": "http://xxxxme/6AFOzdQj2",
                "display_url": "fb.me/6AFOzdQj2"
              }
            ]
          },
          "in_reply_to_screen_name": "zee_alam",
          "in_reply_to_user_id": 263167083,
          "retweet_count": 0,
          "id_str": "833609664973635584",
          "favorited": false,
          "user": {
            "follow_request_sent": false,
            "has_extended_profile": true,
            "profile_use_background_image": false,
            "default_profile_image": false,
            "id": 1217815686,
            "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme8/bg.gif",
            "verified": false,
            "translator_type": "none",
            "profile_text_color": "000000",
            "profile_image_url_https": "https://pbs.twimg.com/profile_images/838740477230911488/B5ynFwDD_normal.jpg",
            "profile_sidebar_fill_color": "000000",
            "entities": {
              "url": {
                "urls": [
                  {
                    "url": "https://xxxxbQ6KljtBK",
                    "indices": [
                      0,
                      23
                    ],
                    "expanded_url": "https://etabz.blogspot.com",
                    "display_url": "etabz.blogspot.com"
                  }
                ]
              },
              "description": {
                "urls": []
              }
            },
            "followers_count": 88,
            "profile_sidebar_border_color": "000000",
            "id_str": "1217815686",
            "profile_background_color": "000000",
            "listed_count": 1,
            "is_translation_enabled": false,
            "utc_offset": 18000,
            "statuses_count": 295,
            "description": "Bi-Tri- quardi | Taekwando & Parkour freak && Climber | Sagittarius 10 |  Lucky  13 | Future is just Unexpected so cheers | Stay happy",
            "friends_count": 157,
            "location": "Islamabd, Pakistan.",
            "profile_link_color": "1B95E0",
            "profile_image_url": "http://pbs.twimg.com/profile_images/838740477230911488/B5ynFwDD_normal.jpg",
            "following": true,
            "geo_enabled": true,
            "profile_banner_url": "https://pbs.twimg.com/profile_banners/1217815686/1468083529",
            "profile_background_image_url": "http://abs.twimg.com/images/themes/theme8/bg.gif",
            "screen_name": "shaamuji",
            "lang": "en",
            "profile_background_tile": false,
            "favourites_count": 169,
            "name": "Ehtisham ullah",
            "notifications": false,
            "url": "https:/xxxxbQ6KljtBK",
            "created_at": "Mon Feb 25 10:08:09 +0000 2013",
            "contributors_enabled": false,
            "time_zone": "Karachi",
            "protected": false,
            "default_profile": false,
            "is_translator": false
          },
          "geo": {
            "type": "Point",
            "coordinates": [
              33.64006041,
              73.07080201
            ]
          },
          "in_reply_to_user_id_str": "263167083",
          "possibly_sensitive": false,
          "lang": "en",
          "created_at": "Mon Feb 20 09:30:06 +0000 2017",
          "in_reply_to_status_id_str": "833583764513181697",
          "place": {
            "country_code": "PK",
            "url": "https://api.twitter.com/1.1/geo/id/008a844c675a661b.json",
            "country": "Pakistan",
            "place_type": "city",
            "bounding_box": {
              "type": "Polygon",
              "coordinates": [
                [
                  [
                    72.952919,
                    33.53611
                  ],
                  [
                    73.122971,
                    33.53611
                  ],
                  [
                    73.122971,
                    33.670082
                  ],
                  [
                    72.952919,
                    33.670082
                  ]
                ]
              ]
            },
            "contained_within": [],
            "full_name": "Rawalpindi, Pakistan",
            "attributes": {},
            "id": "008a844c675a661b",
            "name": "Rawalpindi"
          }
        }
      }

see the result displayed

1 个答案:

答案 0 :(得分:0)

问题解决了,因为问题在于kibana中id的表示。我正在比较四舍五入的值,因为elasticsearch中的原始值不同。 here是详细信息