Skip to content

Instantly share code, notes, and snippets.

@bly2k
Last active August 29, 2015 13:57
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 bly2k/9468905 to your computer and use it in GitHub Desktop.
Save bly2k/9468905 to your computer and use it in GitHub Desktop.
Elasticsearch external mvel script example
Step 1:
Under the config/scripts folder, create a file named helloworld.mvel
Step 2:
Edit the file helloworld.mvel and put this and save:
"hello world"
Step 3:
Restart Elasticsearch
Step 4:
Test the script using a query like this:
curl -XPOST 'localhost:9200/test1/doc' -d '{ "test": "test" }'
curl 'localhost:9200/test1/_search?pretty' -d '{
"script_fields": {
"test": {
"script": "helloworld"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment