Skip to content

Instantly share code, notes, and snippets.

@yunghoy
Last active March 31, 2016 17:56
Show Gist options
  • Save yunghoy/62104fae323f3c679f57330a05b309e6 to your computer and use it in GitHub Desktop.
Save yunghoy/62104fae323f3c679f57330a05b309e6 to your computer and use it in GitHub Desktop.
scripted field examples
_source.duration.value == 0 ? -1 : (_source.duration.value/60000)
doc['duration'].value && (doc['duration'].value/60000)
doc['duration'].value == 0 ? -1 : (doc['duration'].value/60000)
doc['duration'] && (doc['duration'].value/60000)
doc['duration'].value == null ? -1 : (doc['duration'].value/60000)
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#modules-scripting
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-advanced-scripting.html
{"script":"doc['line_id'].value/100"}
In the term of security, elasticsearch is losing their advantage which is easily analyze and fit data.
/etc/elasticsearch/elasticsearch.yml
script.inline: true
script.indexed: true
script.engine.groovy.file.aggs: true
script.engine.groovy.file.mapping: true
script.engine.groovy.file.search: true
script.engine.groovy.file.update: true
script.engine.groovy.file.plugin: true
script.engine.groovy.indexed.aggs: true
script.engine.groovy.indexed.mapping: false
script.engine.groovy.indexed.search: true
script.engine.groovy.indexed.update: false
script.engine.groovy.indexed.plugin: false
script.engine.groovy.inline.aggs: true
script.engine.groovy.inline.mapping: false
script.engine.groovy.inline.search: false
script.engine.groovy.inline.update: false
script.engine.groovy.inline.plugin: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment