Skip to content

Instantly share code, notes, and snippets.

@xeraa
Last active August 2, 2019 01: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 xeraa/3c91a258133d8daa31b51bf8a9df794f to your computer and use it in GitHub Desktop.
Save xeraa/3c91a258133d8daa31b51bf8a9df794f to your computer and use it in GitHub Desktop.
Painless split example
DELETE test
PUT test
{
"mappings": {
"properties": {
"url": {
"type": "keyword"
}
}
}
}
PUT test/_doc/1
{
"url": "http://localhost:9200/test/_doc/hello"
}
POST test/_update/1
{
"script": {
"source": "ctx._source.url_last = ctx._source.url.splitOnToken('/')[-1]"
}
}
GET test/_doc/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment