# Error processing Twitter

**URL:** <https://discuss.elastic.co/t/error-processing-twitter/92059>\
**Category:** Logstash\
**Created:** [July 6, 2017, 9:06am UTC](https://discuss.elastic.co/t/error-processing-twitter/92059 "2017-07-06T09:06:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![legolas\_bilbao](https://avatars.discourse-cdn.com/v4/letter/l/3da27b/32.png) [@legolas\_bilbao](https://discuss.elastic.co/u/legolas_bilbao)\
**Post date:** [July 6, 2017, 9:06am UTC](https://discuss.elastic.co/t/error-processing-twitter/92059/1 "2017-07-06T09:06:58Z")

</div>

Good morning,

1. I've deployed the input plugin filter and it works but during the parsing occurs the following error

> [2017-07-06T11:00:15,593][WARN][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=\>400, :action=\>["index", {:\_id=\>nil, :\_index=\>"twitter-traffic", :\_type=\>"twitter", :\_routing=\>nil}, 2017-07-06T09:00:14.000Z %{host} %{message}], :response=\>{"index"=\>{"\_index"=\>"twitter-traffic", "\_type"=\>"twitter", "\_id"=\>"AV0XINs0X2aWZtZ\_FrYC", "status"=\>400, "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"failed to parse [user]", "caused\_by"=\>{"type"=\>"illegal\_state\_exception", "reason"=\>"Can't get text on a START\_OBJECT at 1:1202"}}}}}  
> [2017-07-06T11:00:15,797][WARN][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=\>400, :action=\>["index", {:\_id=\>nil, :\_index=\>"pan-traffic", :\_type=\>"twitter", :\_routing=\>nil}, 2017-07-06T09:00:14.000Z %{host} %{message}], :response=\>{"index"=\>{"\_index"=\>"pan-traffic", "\_type"=\>"twitter", "\_id"=\>"AV0XINt7X2aWZtZ\_FrYD", "status"=\>400, "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"failed to parse [user]", "caused\_by"=\>{"type"=\>"illegal\_state\_exception", "reason"=\>"Can't get text on a START\_OBJECT at 1:1202"}}}}}  
> [2017-07-06T11:00:15,978][WARN][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=\>400, :action=\>["index", {:\_id=\>nil, :\_index=\>"pan-traffic", :\_type=\>"twitter", :\_routing=\>nil}, 2017-07-06T09:00:14.000Z %{host} %{message}], :response=\>{"index"=\>{"\_index"=\>"pan-traffic", "\_type"=\>"twitter", "\_id"=\>"AV0XINxZX2aWZtZ\_Frd6", "status"=\>400, "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"failed to parse [user]", "caused\_by"=\>{"type"=\>"illegal\_state\_exception", "reason"=\>"Can't get text on a START\_OBJECT at 1:1202"}}}}}

An example of this kind of tweets is the following:

` {"in_reply_to_status_id_str":null,"in_reply_to_status_id":null,"created_at":"Thu Jul 06 09:00:14 +0000 2017","in_reply_to_user_id_str":null,"source":"<a href=\"http://www.egasolineras.com/egasolineras_bot\" rel=\"nofollow\">egasolineras_bot</a>","type":"twitter","retweet_count":0,"retweeted":false,"geo":null,"filter_level":"low","in_reply_to_screen_name":null,"is_quote_status":false,"id_str":"882886899555340288","in_reply_to_user_id":null,"@version":"1","favorite_count":0,"id":882886899555340288,"text":"#Gasolina 95 +barata hasta 5km #Alcorcón #España 1.047€ ALCAMPO AVENIDA EUROPA, S/N L-D: 24H ALCORCON https://t.co/sP4145GWFd","place":null,"lang":"es","favorited":false,"possibly_sensitive":false,"coordinates":null,"truncated":false,"timestamp_ms":"1499331614756","@timestamp":"2017-07-06T09:00:14.000Z","entities":{"urls":[{"display_url":"egasolineras.com/gasolinera/mTz…","indices":[102,125],"expanded_url":"http://www.egasolineras.com/gasolinera/mTztSEiZqcDbrxH","url":"https://t.co/sP4145GWFd"}],"hashtags":[{"indices":[0,9],"text":"Gasolina"},{"indices":[31,40],"text":"Alcorcón"},{"indices":[41,48],"text":"España"}],"user_mentions":[],"symbols":[]},"contributors":null,"user":{"utc_offset":7200,"friends_count":1991,"profile_image_url_https":"https://pbs.twimg.com/profile_images/3004255282/ef6d7a800ca9bfe3ea669b7f9f487f97_normal.png","listed_count":78,"profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png","default_profile_image":false,"favourites_count":1,"description":"Buscador de gasolineras + baratas de España y Chile. Búsquedas por geolocalización, dirección, localidad/provincia, código postal y ruta.","created_at":"Fri Dec 21 22:58:04 +0000 2012","is_translator":false,"profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png","protected":false,"screen_name":"egasolineras","id_str":"1027319756","profile_link_color":"1DA1F2","id":1027319756,"geo_enabled":true,"profile_background_color":"C0DEED","lang":"es","profile_sidebar_border_color":"C0DEED","profile_text_color":"333333","verified":false,"profile_image_url":"http://pbs.twimg.com/profile_images/3004255282/ef6d7a800ca9bfe3ea669b7f9f487f97_normal.png","time_zone":"Madrid","url":"http://www.egasolineras.com","contributors_enabled":false,"profile_background_tile":false,"profile_banner_url":"https://pbs.twimg.com/profile_banners/1027319756/1419617181","statuses_count":169713,"follow_request_sent":null,"followers_count":2590,"profile_use_background_image":true,"default_profile":true,"following":null,"name":"egasolineras.com","location":"Valencia, Spain","profile_sidebar_fill_color":"DDEEF6","notifications":null}}`

the logstash.conf file related to twitter is the following:

```
twitter {
        consumer_key => ""
        consumer_secret => ""
        oauth_token => ""
        oauth_token_secret => ""
        keywords=>["1","2","23","4","5","6","7"]
        type=>"twitter"
        full_tweet=> true
    }

    output{
     elasticsearch{
                index => "twitter-traffic"
                hosts => ["localhost:9200"]
            }

    }

```

any ideas?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 6, 2017, 9:11am UTC](https://discuss.elastic.co/t/error-processing-twitter/92059/2 "2017-07-06T09:11:27Z")

</div>

It looks like the `user` field has been mapped as a string yet the event you're attempting to index is an object.

---

<div class="post-metadata">

**Author:** ![legolas\_bilbao](https://avatars.discourse-cdn.com/v4/letter/l/3da27b/32.png) [@legolas\_bilbao](https://discuss.elastic.co/u/legolas_bilbao)\
**Post date:** [July 6, 2017, 9:27am UTC](https://discuss.elastic.co/t/error-processing-twitter/92059/3 "2017-07-06T09:27:59Z")

</div>

then I've to do the following

mutate {  
convert =\> ["User", "object"]

o generate the different elements included inside user?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [July 6, 2017, 7:50pm UTC](https://discuss.elastic.co/t/error-processing-twitter/92059/4 "2017-07-06T19:50:23Z")

</div>

Why is `user` mapped as a string? Was it by mistake while you were experimenting or do you have other logs using that field name to store strings?

You can't change existing mappings without reindexing, so depending on the answers to the questions above there are a couple of different things to do.

---

<div class="post-metadata">

**Author:** ![legolas\_bilbao](https://avatars.discourse-cdn.com/v4/letter/l/3da27b/32.png) [@legolas\_bilbao](https://discuss.elastic.co/u/legolas_bilbao)\
**Post date:** [July 7, 2017, 9:27am UTC](https://discuss.elastic.co/t/error-processing-twitter/92059/5 "2017-07-07T09:27:23Z")

</div>

Good morning Magnus,

I've regenerate the template and its works.

many thanks

---

<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:** [August 4, 2017, 9:27am UTC](https://discuss.elastic.co/t/error-processing-twitter/92059/6 "2017-08-04T09:27:36Z")

</div>

Closed on August 4, 2017, 9:27am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
