2016-07-06 59 views
0

我试图将logstash连接到twitter。所有的Twitter是user.geo_enabled =假解析的好,但另一方面,如果user.geo_enabled =真我收到此错误:当geo_enable = true时logstash Twitter错误

Failed action. {:status=>400, :action=>["index", {:_id=>nil,  :_index=>"twitter", :_type=>"logs", :_routing=>nil}, #<LogStash::Event:0xb1b69ba @metadata_accessors=#<LogStash::Util::Accessors:0x74b553ef @store={}, @lut={}>, @cancelled=false, @data={"created_at"=>"Wed Jul 06 16:15:26 +0000 2016", "id"=>750724847626493953, "id_str"=>"750724847626493953", "text"=>"@HillaryClinton I would never vote for you", "source"=>"<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>", "truncated"=>false, "in_reply_to_status_id"=>nil, "in_reply_to_status_id_str"=>nil, "in_reply_to_user_id"=>1339835893, "in_reply_to_user_id_str"=>"1339835893", "in_reply_to_screen_name"=>"HillaryClinton", "user"=>{"id"=>772001468, "id_str"=>"772001468", "name"=>"charles c hutchison", "screen_name"=>"49_mail", "location"=>nil, "url"=>nil, "description"=>nil, "protected"=>false, "verified"=>false, "followers_count"=>8, "friends_count"=>99, "listed_count"=>0, "favourites_count"=>8, "statuses_count"=>176, "created_at"=>"Tue Aug 21 18:22:06 +0000 2012", "utc_offset"=>nil, "time_zone"=>nil, "geo_enabled"=>true, "lang"=>"en", "contributors_enabled"=>false, "is_translator"=>false, "profile_background_color"=>"C0DEED", "profile_background_image_url"=>"http://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_image_url_https"=>"https://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_tile"=>false, "profile_link_color"=>"0084B4", "profile_sidebar_border_color"=>"C0DEED", "profile_sidebar_fill_color"=>"DDEEF6", "profile_text_color"=>"333333", "profile_use_background_image"=>true, "profile_image_url"=>"http://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png", "profile_image_url_https"=>"https://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png", "default_profile"=>true, "default_profile_image"=>true, "following"=>nil, "follow_request_sent"=>nil, "notifications"=>nil}, "geo"=>{"type"=>"Point", "coordinates"=>[#<BigDecimal:6d26d63b,'0.384274583E2',9(12)>, #<BigDecimal:43f314b6,'-0.823958636E2',9(12)>]}, "coordinates"=>{"type"=>"Point", "coordinates"=>[#<BigDecimal:669bf464,'-0.823958636E2',9(12)>, #<BigDecimal:3d160aa5,'0.384274583E2',9(12)>]}, "place"=>{"id"=>"e4197a23034fa912", "url"=>"https://api.twitter.com/1.1/geo/id/e4197a23034fa912.json", "place_type"=>"city", "name"=>"Huntington", "full_name"=>"Huntington, WV", "country_code"=>"US", "country"=>"United States", "bounding_box"=>{"type"=>"Polygon", "coordinates"=>[[[#<BigDecimal:4feaddd3,'-0.82530433E2',8(12)>, #<BigDecimal:5438cd7c,'0.38375981E2',8(12)>], [#<BigDecimal:413b49ac,'-0.82530433E2',8(12)>, #<BigDecimal:58a6101d,'0.38439347E2',8(12)>], [#<BigDecimal:445e692e,'-0.82349236E2',8(12)>, #<BigDecimal:5f332e20,'0.38439347E2',8(12)>], [#<BigDecimal:46c19531,'-0.82349236E2',8(12)>, #<BigDecimal:71e183de,'0.38375981E2',8(12)>]]]}, "attributes"=>{}}, "contributors"=>nil, "is_quote_status"=>false, "retweet_count"=>0, "favorite_count"=>0, "entities"=>{"hashtags"=>[], "urls"=>[], "user_mentions"=>[{"screen_name"=>"HillaryClinton", "name"=>"Hillary Clinton", "id"=>1339835893, "id_str"=>"1339835893", "indices"=>[0, 15]}], "symbols"=>[]}, "favorited"=>false, "retweeted"=>false, "filter_level"=>"low", "lang"=>"en", "timestamp_ms"=>"1467821726124", "@version"=>"1", "@timestamp"=>"2016-07-06T16:15:26.000Z"}, @metadata={}, @accessors=#<LogStash::Util::Accessors:0x40cb306f @store={"created_at"=>"Wed Jul 06 16:15:26 +0000 2016", "id"=>750724847626493953, "id_str"=>"750724847626493953", "text"=>"@HillaryClinton I would never vote for you", "source"=>"<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>", "truncated"=>false, "in_reply_to_status_id"=>nil, "in_reply_to_status_id_str"=>nil, "in_reply_to_user_id"=>1339835893, "in_reply_to_user_id_str"=>"1339835893", "in_reply_to_screen_name"=>"HillaryClinton", "user"=>{"id"=>772001468, "id_str"=>"772001468", "name"=>"charles c hutchison", "screen_name"=>"49_mail", "location"=>nil, "url"=>nil, "description"=>nil, "protected"=>false, "verified"=>false, "followers_count"=>8, "friends_count"=>99, "listed_count"=>0, "favourites_count"=>8, "statuses_count"=>176, "created_at"=>"Tue Aug 21 18:22:06 +0000 2012", "utc_offset"=>nil, "time_zone"=>nil, "geo_enabled"=>true, "lang"=>"en", "contributors_enabled"=>false, "is_translator"=>false, "profile_background_color"=>"C0DEED", "profile_background_image_url"=>"http://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_image_url_https"=>"https://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_tile"=>false, "profile_link_color"=>"0084B4", "profile_sidebar_border_color"=>"C0DEED", "profile_sidebar_fill_color"=>"DDEEF6", "profile_text_color"=>"333333", "profile_use_background_image"=>true, "profile_image_url"=>"http://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png", "profile_image_url_https"=>"https://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png", "default_profile"=>true, "default_profile_image"=>true, "following"=>nil, "follow_request_sent"=>nil, "notifications"=>nil}, "geo"=>{"type"=>"Point", "coordinates"=>[#<BigDecimal:6d26d63b,'0.384274583E2',9(12)>, #<BigDecimal:43f314b6,'-0.823958636E2',9(12)>]}, "coordinates"=>{"type"=>"Point", "coordinates"=>[#<BigDecimal:669bf464,'-0.823958636E2',9(12)>, #<BigDecimal:3d160aa5,'0.384274583E2',9(12)>]}, "place"=>{"id"=>"e4197a23034fa912", "url"=>"https://api.twitter.com/1.1/geo/id/e4197a23034fa912.json", "place_type"=>"city", "name"=>"Huntington", "full_name"=>"Huntington, WV", "country_code"=>"US", "country"=>"United States", "bounding_box"=>{"type"=>"Polygon", "coordinates"=>[[[#<BigDecimal:4feaddd3,'-0.82530433E2',8(12)>, #<BigDecimal:5438cd7c,'0.38375981E2',8(12)>], [#<BigDecimal:413b49ac,'-0.82530433E2',8(12)>, #<BigDecimal:58a6101d,'0.38439347E2',8(12)>], [#<BigDecimal:445e692e,'-0.82349236E2',8(12)>, #<BigDecimal:5f332e20,'0.38439347E2',8(12)>], [#<BigDecimal:46c19531,'-0.82349236E2',8(12)>, #<BigDecimal:71e183de,'0.38375981E2',8(12)>]]]}, "attributes"=>{}}, "contributors"=>nil, "is_quote_status"=>false, "retweet_count"=>0, "favorite_count"=>0, "entities"=>{"hashtags"=>[], "urls"=>[], "user_mentions"=>[{"screen_name"=>"HillaryClinton", "name"=>"Hillary Clinton", "id"=>1339835893, "id_str"=>"1339835893", "indices"=>[0, 15]}], "symbols"=>[]}, "favorited"=>false, "retweeted"=>false, "filter_level"=>"low", "lang"=>"en", "timestamp_ms"=>"1467821726124", "@version"=>"1", "@timestamp"=>"2016-07-06T16:15:26.000Z"}, @lut={"in-reply-to"=>[{"created_at"=>"Wed Jul 06 16:15:26 +0000 2016", "id"=>750724847626493953, "id_str"=>"750724847626493953", "text"=>"@HillaryClinton I would never vote for you", "source"=>"<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>", "truncated"=>false, "in_reply_to_status_id"=>nil, "in_reply_to_status_id_str"=>nil, "in_reply_to_user_id"=>1339835893, "in_reply_to_user_id_str"=>"1339835893", "in_reply_to_screen_name"=>"HillaryClinton", "user"=>{"id"=>772001468, "id_str"=>"772001468", "name"=>"charles c hutchison", "screen_name"=>"49_mail", "location"=>nil, "url"=>nil, "description"=>nil, "protected"=>false, "verified"=>false, "followers_count"=>8, "friends_count"=>99, "listed_count"=>0, "favourites_count"=>8, "statuses_count"=>176, "created_at"=>"Tue Aug 21 18:22:06 +0000 2012", "utc_offset"=>nil, "time_zone"=>nil, "geo_enabled"=>true, "lang"=>"en", "contributors_enabled"=>false, "is_translator"=>false, "profile_background_color"=>"C0DEED", "profile_background_image_url"=>"http://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_image_url_https"=>"https://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_tile"=>false, "profile_link_color"=>"0084B4", "profile_sidebar_border_color"=>"C0DEED", "profile_sidebar_fill_color"=>"DDEEF6", "profile_text_color"=>"333333", "profile_use_background_image"=>true, "profile_image_url"=>"http://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png", "profile_image_url_https"=>"https://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png", "default_profile"=>true, "default_profile_image"=>true, "following"=>nil, "follow_request_sent"=>nil, "notifications"=>nil}, "geo"=>{"type"=>"Point", "coordinates"=>[#<BigDecimal:6d26d63b,'0.384274583E2',9(12)>, #<BigDecimal:43f314b6,'-0.823958636E2',9(12)>]}, "coordinates"=>{"type"=>"Point", "coordinates"=>[#<BigDecimal:669bf464,'-0.823958636E2',9(12)>, #<BigDecimal:3d160aa5,'0.384274583E2',9(12)>]}, "place"=>{"id"=>"e4197a23034fa912", "url"=>"https://api.twitter.com/1.1/geo/id/e4197a23034fa912.json", "place_type"=>"city", "name"=>"Huntington", "full_name"=>"Huntington, WV", "country_code"=>"US", "country"=>"United States", "bounding_box"=>{"type"=>"Polygon", "coordinates"=>[[[#<BigDecimal:4feaddd3,'-0.82530433E2',8(12)>, #<BigDecimal:5438cd7c,'0.38375981E2',8(12)>], [#<BigDecimal:413b49ac,'-0.82530433E2',8(12)>, #<BigDecimal:58a6101d,'0.38439347E2',8(12)>], [#<BigDecimal:445e692e,'-0.82349236E2',8(12)>, #<BigDecimal:5f332e20,'0.38439347E2',8(12)>], [#<BigDecimal:46c19531,'-0.82349236E2',8(12)>, #<BigDecimal:71e183de,'0.38375981E2',8(12)>]]]}, "attributes"=>{}}, "contributors"=>nil, "is_quote_status"=>false, "retweet_count"=>0, "favorite_count"=>0, "entities"=>{"hashtags"=>[], "urls"=>[], "user_mentions"=>[{"screen_name"=>"HillaryClinton", "name"=>"Hillary Clinton", "id"=>1339835893, "id_str"=>"1339835893", "indices"=>[0, 15]}], "symbols"=>[]}, "favorited"=>false, "retweeted"=>false, "filter_level"=>"low", "lang"=>"en", "timestamp_ms"=>"1467821726124", "@version"=>"1", "@timestamp"=>"2016-07-06T16:15:26.000Z"}, "in-reply-to"], "type"=>[{"created_at"=>"Wed Jul 06 16:15:26 +0000 2016", "id"=>750724847626493953, "id_str"=>"750724847626493953", "text"=>"@HillaryClinton I would never vote for you", "source"=>"<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>", "truncated"=>false, "in_reply_to_status_id"=>nil, "in_reply_to_status_id_str"=>nil, "in_reply_to_user_id"=>1339835893, "in_reply_to_user_id_str"=>"1339835893", "in_reply_to_screen_name"=>"HillaryClinton", "user"=>{"id"=>772001468, "id_str"=>"772001468", "name"=>"charles c hutchison", "screen_name"=>"49_mail", "location"=>nil, "url"=>nil, "description"=>nil, "protected"=>false, "verified"=>false, "followers_count"=>8, "friends_count"=>99, "listed_count"=>0, "favourites_count"=>8, "statuses_count"=>176, "created_at"=>"Tue Aug 21 18:22:06 +0000 2012", "utc_offset"=>nil, "time_zone"=>nil, "geo_enabled"=>true, "lang"=>"en", "contributors_enabled"=>false, "is_translator"=>false, "profile_background_color"=>"C0DEED", "profile_background_image_url"=>"http://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_image_url_https"=>"https://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_tile"=>false, "profile_link_color"=>"0084B4", "profile_sidebar_border_color"=>"C0DEED", "profile_sidebar_fill_color"=>"DDEEF6", "profile_text_color"=>"333333", "profile_use_background_image"=>true, "profile_image_url"=>"http://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png", "profile_image_url_https"=>"https://abs.twimg.com/sticky/default_profile_images/default_profile_0_normal.png", "default_profile"=>true, "default_profile_image"=>true, "following"=>nil, "follow_request_sent"=>nil, "notifications"=>nil}, "geo"=>{"type"=>"Point", "coordinates"=>[#<BigDecimal:6d26d63b,'0.384274583E2',9(12)>, #<BigDecimal:43f314b6,'-0.823958636E2',9(12)>]}, "coordinates"=>{"type"=>"Point", "coordinates"=>[#<BigDecimal:669bf464,'-0.823958636E2',9(12)>, #<BigDecimal:3d160aa5,'0.384274583E2',9(12)>]}, "place"=>{"id"=>"e4197a23034fa912", "url"=>"https://api.twitter.com/1.1/geo/id/e4197a23034fa912.json", "place_type"=>"city", "name"=>"Huntington", "full_name"=>"Huntington, WV", "country_code"=>"US", "country"=>"United States", "bounding_box"=>{"type"=>"Polygon", "coordinates"=>[[[#<BigDecimal:4feaddd3,'-0.82530433E2',8(12)>, #<BigDecimal:5438cd7c,'0.38375981E2',8(12)>], [#<BigDecimal:413b49ac,'-0.82530433E2',8(12)>, #<BigDecimal:58a6101d,'0.38439347E2',8(12)>], [#<BigDecimal:445e692e,'-0.82349236E2',8(12)>, #<BigDecimal:5f332e20,'0.38439347E2',8(12)>], [#<BigDecimal:46c19531,'-0.82349236E2',8(12)>, #<BigDecimal:71e183de,'0.38375981E2',8(12)>]]]}, "attributes"=>{}}, "contributors"=>nil, "is_quote_status"=>false, "retweet_count"=>0, "favorite_count"=>0, "entities"=>{"hashtags"=>[], "urls"=>[], "user_mentions"=>[{"screen_name"=>"HillaryClinton", "name"=>"Hillary Clinton", "id"=>1339835893, "id_str"=>"1339835893", "indices"=>[0, 15]}], "symbols"=>[]}, "favorited"=>false, "retweeted"=>false, "filter_level"=>"low", "lang"=>"en", "timestamp_ms"=>"1467821726124", "@version"=>"1", "@timestamp"=>"2016-07-06T16:15:26.000Z"}, "type"]}>>], :response=>{"create"=>{"_index"=>"twitter", "_type"=>"logs", "_id"=>"AVXA_h0IgT1Xitpna0uT", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Mixing up field types: class org.elasticsearch.index.mapper.core.DoubleFieldMapper$DoubleFieldType != class org.elasticsearch.index.mapper.geo.BaseGeoPointFieldMapper$GeoPointFieldType on field coordinates.coordinates"}}}}, :level=>:warn} 

我认为培训相关线路

{"create"=>{"_index"=>"twitter", "_type"=>"logs", "_id"=>"AVXA_h0IgT1Xitpna0uT", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Mixing up field types: class org.elasticsearch.index.mapper.core.DoubleFieldMapper$DoubleFieldType != class 
    org.elasticsearch.index.mapper.geo.BaseGeoPointFieldMapper$GeoPointFieldType on field coordinates.coordinates"}}}}, :level=>:warn} 

我模板是:

{ 
"template": "twitter", 
"order": 1, 
"settings": { 
"number_of_shards": 1 
}, 
"mappings": { 
    "tweet": { 
    "_all": { 
     "enabled": false 
    }, 
    "properties": { 
     "coordinates": { 
     "properties": { 
      "coordinates": { 
      "type": "geo_point" 
     }, 
     "type": { 
      "type": "string" 
      } 
     } 
     } 
    } 
    } 
    } 
} 

可能是什么问题?

谢谢。

回答

1

问题是ES中的字段coordinates.coordinates预期的数据类型不是收到的类型。

解决方案是修改模板,删除坐标类型。然后你删除你的索引并重新索引你的数据。在这种情况下,预期类型的​​coordinates.coordinates将取决于插入的数据。
这应该可以解决问题。