Skip to content

Commit

Permalink
Add a note on multi-statement scripted field limitation
Browse files Browse the repository at this point in the history
Backports PR #9090

**Commit 1:**
Add a note on multi-statement scripted field limitation

Multi-statement scripts are currently incompatible with the way we
create filters on scripted fields. We're investigating the possibility
of enhancing elasticsearch to fix this issue, but we may have to
fallback on showing users a warning if we can't reach an agreement in
the near term.

See #9024
Related elastic/elasticsearch#21479

* Original sha: b4aaed8
* Authored by Matthew Bargar <[email protected]> on 2016-11-15T22:47:26Z
  • Loading branch information
elastic-jasper committed Nov 17, 2016
1 parent f8854cd commit 38f2d70
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ui/public/field_editor/field_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,19 @@ <h4>
Painless is powerful but easy to use. It provides access to many <a target="_window" ng-href="{{editor.docLinks.painlessApi}}">native Java APIs <i class="fa-link fa"></i></a>. Read up on its <a target="_window" ng-href="{{editor.docLinks.painlessSyntax}}">syntax <i class="fa-link fa"></i></a> and you'll be up to speed in no time!
</p>

<p>
Kibana currently imposes one special limitation on the scripts you write. Your scripts must consist of a single expression. Multi-statement scripts with an explicit return statement will not work.
In other words, the above example is a valid script, but something like the following is not.
</p>

<p>
<strong>Invalid</strong><br/>
<code>
def myField = doc['some_field'].value;<br/>
return myField;
</code>
</p>

<p>
Coming from an older version of Kibana? The <a target="_window" ng-href="{{editor.docLinks.luceneExpressions}}">Lucene Expressions <i class="fa-link fa"></i></a> you know and love are still available. Lucene expressions are a lot like JavaScript, but limited to basic arithmetic, bitwise and comparison operations.
</p>
Expand Down

0 comments on commit 38f2d70

Please sign in to comment.