Skip to content

Invalid LinearRing found on geo_shapes taken from real tweets #14174

@synhershko

Description

@synhershko

Trying to index twitter data using logstash with full_tweet => true I get the following exception. Since this happens quite frequently, and using fresh Twitter data, I assume the Elasticsearch implementation to either be buggy or too strict.

org.elasticsearch.index.mapper.MapperParsingException: failed to parse [place.bounding_box]
    at org.elasticsearch.index.mapper.geo.GeoShapeFieldMapper.parse(GeoShapeFieldMapper.java:263)
    at org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(ObjectMapper.java:554)
    at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:487)
    at org.elasticsearch.index.mapper.object.ObjectMapper.serializeObject(ObjectMapper.java:554)
    at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:487)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:544)
    at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:493)
    at org.elasticsearch.index.shard.IndexShard.prepareCreate(IndexShard.java:466)
    at org.elasticsearch.action.bulk.TransportShardBulkAction.shardIndexOperation(TransportShardBulkAction.java:418)
    at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:148)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase.performOnPrimary(TransportShardReplicationOperationAction.java:574)
    at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase$1.doRun(TransportShardReplicationOperationAction.java:440)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:36)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.elasticsearch.ElasticsearchParseException: Invalid LinearRing found (coordinates are not closed)
    at org.elasticsearch.common.geo.builders.ShapeBuilder$GeoShapeType.parseLinearRing(ShapeBuilder.java:892)
    at org.elasticsearch.common.geo.builders.ShapeBuilder$GeoShapeType.parsePolygon(ShapeBuilder.java:903)
    at org.elasticsearch.common.geo.builders.ShapeBuilder$GeoShapeType.parse(ShapeBuilder.java:777)
    at org.elasticsearch.common.geo.builders.ShapeBuilder.parse(ShapeBuilder.java:293)
    at org.elasticsearch.index.mapper.geo.GeoShapeFieldMapper.parse(GeoShapeFieldMapper.java:244)
    ... 15 more

I have the following defined in my template:

               "place":{
                  "properties":{
                     "bounding_box":{
                          "type": "geo_shape"
                     },

Here is a sample tweet:

{"created_at":"Sat Oct 17 22:22:10 +0000 2015","id":655509130422022145,"id_str":"655509130422022145","text":"Getting Inspired #FriezeArtFair #London #DmitrySholokhov http://t.co/4CVsxImujl","source":"<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":279132601,"id_str":"279132601","name":"Dmitry Sholokhov","screen_name":"DmitrySholokhov","location":"New York","url":"http://dmitrysholokhov.com","description":"NYC based Fashion Designer, TV Personality Winner of both  Project Runway & Project Runway All Stars. Appearances, Business Inquairies: [email protected]","protected":false,"verified":false,"followers_count":10509,"friends_count":78,"listed_count":132,"favourites_count":1792,"statuses_count":1463,"created_at":"Fri Apr 08 17:06:09 +0000 2011","utc_offset":-18000,"time_zone":"Quito","geo_enabled":true,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C6E2EE","profile_background_image_url":"http://pbs.twimg.com/profile_background_images/566193376/g1x6ejqbntgpwey1b3hp.jpeg","profile_background_image_url_https":"https://pbs.twimg.com/profile_background_images/566193376/g1x6ejqbntgpwey1b3hp.jpeg","profile_background_tile":false,"profile_link_color":"1F98C7","profile_sidebar_border_color":"C6E2EE","profile_sidebar_fill_color":"DAECF4","profile_text_color":"663B12","profile_use_background_image":false,"profile_image_url":"http://pbs.twimg.com/profile_images/2247167131/563434_698079755757_34601070_34311803_1800819434_n_normal.jpg","profile_image_url_https":"https://pbs.twimg.com/profile_images/2247167131/563434_698079755757_34601070_34311803_1800819434_n_normal.jpg","profile_banner_url":"https://pbs.twimg.com/profile_banners/279132601/1393385297","default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":{"id":"5de8cffc145c486b","url":"https://api.twitter.com/1.1/geo/id/5de8cffc145c486b.json","place_type":"city","name":"Camden Town","full_name":"Camden Town, London","country_code":"GB","country":"United Kingdom","bounding_box":{"type":"Polygon","coordinates":[[[-0.213503,51.512805],[-0.213503,51.572068],[-0.105303,51.572068],[-0.105303,51.512805]]]},"attributes":{}},"contributors":null,"is_quote_status":false,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[{"text":"FriezeArtFair","indices":[17,31]},{"text":"London","indices":[32,39]},{"text":"DmitrySholokhov","indices":[40,56]}],"urls":[],"user_mentions":[],"symbols":[],"media":[{"id":655509108599033856,"id_str":"655509108599033856","indices":[57,79],"media_url":"http://pbs.twimg.com/media/CRjWD60UEAABJ67.jpg","media_url_https":"https://pbs.twimg.com/media/CRjWD60UEAABJ67.jpg","url":"http://t.co/4CVsxImujl","display_url":"pic.twitter.com/4CVsxImujl","expanded_url":"http://twitter.com/DmitrySholokhov/status/655509130422022145/photo/1","type":"photo","sizes":{"small":{"w":340,"h":340,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"medium":{"w":600,"h":600,"resize":"fit"},"large":{"w":1024,"h":1024,"resize":"fit"}}}]},"extended_entities":{"media":[{"id":655509108599033856,"id_str":"655509108599033856","indices":[57,79],"media_url":"http://pbs.twimg.com/media/CRjWD60UEAABJ67.jpg","media_url_https":"https://pbs.twimg.com/media/CRjWD60UEAABJ67.jpg","url":"http://t.co/4CVsxImujl","display_url":"pic.twitter.com/4CVsxImujl","expanded_url":"http://twitter.com/DmitrySholokhov/status/655509130422022145/photo/1","type":"photo","sizes":{"small":{"w":340,"h":340,"resize":"fit"},"thumb":{"w":150,"h":150,"resize":"crop"},"medium":{"w":600,"h":600,"resize":"fit"},"large":{"w":1024,"h":1024,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"filter_level":"low","lang":"en","timestamp_ms":"1445120530120","@version":"1","@timestamp":"2015-10-17T22:22:10.000Z"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions