Skip to content

Instantly share code, notes, and snippets.

@synhershko
Created July 19, 2016 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save synhershko/665530fc71eac0a0232145a667175891 to your computer and use it in GitHub Desktop.
Save synhershko/665530fc71eac0a0232145a667175891 to your computer and use it in GitHub Desktop.
ES template for Twitter data
{
"template" : "twitter*",
"settings": {
"number_of_replicas" : 0, "number_of_shards" : 1,
"analysis": {
"analyzer": {
"html_keyword": {
"type":"custom",
"tokenizer": "keyword",
"char_filter": ["html_strip"]
}
}
}
},
"mappings":{
"tweet":{
"dynamic_templates":[
{"unindexed_fields":{"mapping":{"enabled":false,"type":"object"},"match":"*"}}
],
"properties": {
"@timestamp":{
"type":"date",
"format":"dateOptionalTime"
},
"coordinates":{
"properties": {
"coordinates": {
"type": "geo_point"
},
"type": {
"type": "string"
}
}
},
"created_at":{
"type":"date",
"format": "E MMM dd HH:mm:ss Z yyyy"
},
"entities":{
"properties":{
"hashtags":{
"properties":{
"text":{
"type":"string"
}
}
},
"media":{
"properties":{
"expanded_url":{
"type":"string", "index": "not_analyzed"
},
"id_str":{
"type":"string", "index": "not_analyzed"
},
"media_url":{
"type":"string", "index": "not_analyzed"
},
"media_url_https":{
"type":"string", "index": "not_analyzed"
},
"source_status_id_str":{
"type":"string", "index": "not_analyzed"
},
"source_user_id_str":{
"type":"string", "index": "not_analyzed"
},
"type":{
"type":"string", "index": "not_analyzed"
},
"url":{
"type":"string", "index": "not_analyzed"
}
}
},
"urls":{
"properties":{
"display_url":{
"type":"string", "index": "not_analyzed"
},
"expanded_url":{
"type":"string", "index": "not_analyzed"
},
"url":{
"type":"string", "index": "not_analyzed"
}
}
},
"user_mentions":{
"properties":{
"id_str":{
"type":"string", "index": "not_analyzed"
},
"name":{
"type":"string"
},
"screen_name":{
"type":"string"
}
}
}
}
},
"favorite_count":{
"type":"long"
},
"favorited":{
"type":"boolean"
},
"filter_level":{
"type":"string", "index": "not_analyzed"
},
"geo":{
"properties": {
"coordinates": {
"type": "geo_point"
},
"type": {
"type": "string"
}
}
},
"id_str":{
"type":"string", "index": "not_analyzed"
},
"in_reply_to_screen_name":{
"type":"string", "index": "not_analyzed"
},
"in_reply_to_status_id_str":{
"type":"string", "index": "not_analyzed"
},
"in_reply_to_user_id_str":{
"type":"string", "index": "not_analyzed"
},
"is_quote_status":{
"type":"boolean"
},
"lang":{
"type":"string", "index":"not_analyzed"
},
"place":{
"properties":{
"country":{
"type":"string"
},
"country_code":{
"type":"string", "index": "not_analyzed"
},
"full_name":{
"type":"string", "index": "not_analyzed"
},
"id":{
"type":"string", "index": "not_analyzed"
},
"name":{
"type":"string"
},
"place_type":{
"type":"string", "index": "not_analyzed"
},
"url":{
"type":"string", "index": "not_analyzed"
}
}
},
"possibly_sensitive":{
"type":"boolean"
},
"quoted_status_id_str":{
"type":"string", "index": "not_analyzed"
},
"retweet_count":{
"type":"long"
},
"retweeted":{
"type":"boolean"
},
"source":{
"type":"string", "analyzer": "html_keyword"
},
"text":{
"type":"string"
},
"timestamp_ms":{
"type":"long"
},
"truncated":{
"type":"boolean"
},
"user":{
"properties":{
"favourites_count":{
"type":"long"
},
"followers_count":{
"type":"long"
},
"friends_count":{
"type":"long"
},
"geo_enabled":{
"type":"boolean"
},
"id_str":{
"type":"string", "index": "not_analyzed"
},
"is_translator":{
"type":"boolean"
},
"lang":{
"type":"string", "index": "not_analyzed"
},
"location":{
"type":"string"
},
"name":{
"type":"string",
"fields": {
"raw": { "type": "string", "index": "not_analyzed"}
}
},
"protected":{
"type":"boolean"
},
"screen_name":{
"type": "string",
"fields": {
"raw": { "type": "string", "index": "not_analyzed"}
}
},
"statuses_count":{
"type":"long"
},
"time_zone":{
"type":"string"
},
"url":{
"type":"string"
},
"utc_offset":{
"type":"long"
},
"verified":{
"type":"boolean"
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment