# Newby

**URL:** <https://discuss.elastic.co/t/newby/50663>\
**Category:** Elasticsearch\
**Created:** [May 23, 2016, 1:29am UTC](https://discuss.elastic.co/t/newby/50663 "2016-05-23T01:29:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jen](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@Jen](https://discuss.elastic.co/u/Jen)\
**Post date:** [May 23, 2016, 1:29am UTC](https://discuss.elastic.co/t/newby/50663/1 "2016-05-23T01:29:07Z")

</div>

I started indexing. Then I changed my code to include additional fields but the new fields are "not indexed" according to Kibana. How do I make the new fields indexed as well?  
Thank you

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 23, 2016, 3:53am UTC](https://discuss.elastic.co/t/newby/50663/2 "2016-05-23T03:53:48Z")

</div>

What does the mapping look like?

Also, it helps others help you if you have a better topic 🙂

---

<div class="post-metadata">

**Author:** ![Jen](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@Jen](https://discuss.elastic.co/u/Jen)\
**Post date:** [May 23, 2016, 4:28am UTC](https://discuss.elastic.co/t/newby/50663/3 "2016-05-23T04:28:23Z")

</div>

Hello. Thank you. This is the code

import json from tweepy.streaming import StreamListener from tweepy import  
OAuthHandler from tweepy import Stream from textblob import TextBlob from  
elasticsearch import Elasticsearch # import twitter keys and tokens from  
config import \* # create instance of elasticsearch es = Elasticsearch()  
class TweetStreamListener(StreamListener): # on success def on\_data(self,  
data): # decode json dict\_data = json.loads(data) # pass tweet into  
TextBlob tweet = TextBlob(dict\_data["text"]) # output sentiment polarity  
print tweet.sentiment.polarity # determine if sentiment is positive,  
negative, or neutral if tweet.sentiment.polarity \< 0: sentiment =  
"negative" elif tweet.sentiment.polarity == 0: sentiment = "neutral" else:  
sentiment = "positive" # output sentiment print sentiment # add text and  
sentiment info to elasticsearch es.index(index="sentiment",  
doc\_type="test-type", body={"author": dict\_data["user"]["screen\_name"],  
"date": dict\_data["created\_at"], "message": dict\_data["text"], "polarity":  
tweet.sentiment.polarity, "subjectivity": tweet.sentiment.subjectivity,  
"sentiment": sentiment}) return True # on failure def on\_error(self,  
status): print status if **name** == ' **main**': # create instance of the  
tweepy tweet stream listener listener = TweetStreamListener() # set twitter  
keys/tokens auth = OAuthHandler(consumer\_key, consumer\_secret)  
auth.set\_access\_token(access\_token, access\_token\_secret) # create instance  
of the tweepy stream stream = Stream(auth, listener) # search twitter for  
"congress" keyword stream.filter(track=['congress'])

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 23, 2016, 4:31am UTC](https://discuss.elastic.co/t/newby/50663/4 "2016-05-23T04:31:19Z")

</div>

It'd help if you could format it properly, use the `</>` button.

---

<div class="post-metadata">

**Author:** ![Jen](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@Jen](https://discuss.elastic.co/u/Jen)\
**Post date:** [May 23, 2016, 4:34am UTC](https://discuss.elastic.co/t/newby/50663/5 "2016-05-23T04:34:51Z")

</div>

I tried to add in an id field for the tweet. According to Twitter  
The integer representation of the unique identifier for this Tweet. This  
number is greater than 53 bits and some programming languages may have  
difficulty/silent defects in interpreting it. Using a signed 64 bit integer  
for storing this identifier is safe. Use id\_str for fetching the identifier  
to stay on the safe side. SeeTwitter  
[https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake](https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake) IDs,  
[https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake](https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake)JSON  
[https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake](https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake) and  
Snowflake  
[https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake](https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake).

Example:

"id":114749583439036416

Hello. Thank you. This is the code

import json from tweepy.streaming import StreamListener from tweepy import  
OAuthHandler from tweepy import Stream from textblob import TextBlob from  
elasticsearch import Elasticsearch # import twitter keys and tokens from  
config import \* # create instance of elasticsearch es = Elasticsearch()  
class TweetStreamListener(StreamListener): # on success def on\_data(self,  
data): # decode json dict\_data = json.loads(data) # pass tweet into  
TextBlob tweet = TextBlob(dict\_data["text"]) # output sentiment polarity  
print tweet.sentiment.polarity # determine if sentiment is positive,  
negative, or neutral if tweet.sentiment.polarity \< 0: sentiment =  
"negative" elif tweet.sentiment.polarity == 0: sentiment = "neutral" else:  
sentiment = "positive" # output sentiment print sentiment # add text and  
sentiment info to elasticsearch es.index(index="sentiment",  
doc\_type="test-type", body={"author": dict\_data["user"]["screen\_name"],  
"date": dict\_data["created\_at"], "message": dict\_data["text"], "polarity":  
tweet.sentiment.polarity, "subjectivity": tweet.sentiment.subjectivity,  
"sentiment": sentiment}) return True # on failure def on\_error(self,  
status): print status if **name** == ' **main**': # create instance of the  
tweepy tweet stream listener listener = TweetStreamListener() # set twitter  
keys/tokens auth = OAuthHandler(consumer\_key, consumer\_secret)  
auth.set\_access\_token(access\_token, access\_token\_secret) # create instance  
of the tweepy stream stream = Stream(auth, listener) # search twitter for  
"congress" keyword stream.filter(track=['congress'])

---

<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:** [July 5, 2017, 10:49pm UTC](https://discuss.elastic.co/t/newby/50663/6 "2017-07-05T22:49:53Z")

</div>


