Skip to content

Instantly share code, notes, and snippets.

@synhershko
Created January 16, 2017 13:51
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/4ada9ad37bde8f7278446557b443e8b4 to your computer and use it in GitHub Desktop.
Save synhershko/4ada9ad37bde8f7278446557b443e8b4 to your computer and use it in GitHub Desktop.
copy_to elastic search example
DELETE twitter
PUT twitter
{
"mappings": {
"tweet": {
"properties": {
"catch_all": {
"type":"text"
},
"@timestamp": {
"type": "date"
},
"@version": {
"type": "integer"
},
"client": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"message": {
"type": "text",
"copy_to": "catch_all"
},
"retweeted": {
"type": "boolean"
},
"source": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"urls": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"user": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"copy_to": "catch_all"
}
}
}
}
}
PUT twitter/tweet/AVmm_HbZbhIMM7q-rQaZ
{
"@timestamp": "2014-11-26T16:59:05.000Z",
"message": "RT @UKIP: UKIP Leader @Nigel_Farage: If Owen Paterson wants to leave the EU he should join UKIP. http://t.co/NTX6X0YoTn",
"user": "scousedaz77",
"client": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>",
"retweeted": false,
"source": "http://twitter.com/scousedaz77/status/537651770668101634",
"@version": 1,
"urls": [
"http://www.breitbart.com/Breitbart-London/2014/11/26/Nigel-Farage-If-Owen-Paterson-Wants-to-Leave-the-EU-He-Should-Join-UKIP"
]
}
POST twitter/_search
{
"query": {
"match": {
"catch_all": "Paterson"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment