Kibana - Error including scripted fields in aggregation

Hello,

I am trying to add a manually created scripted field using the dropdown box
withing Aggregation:

Any pointers on how to resolve this error would be very helpful.

Scriped field:
Name: @hourOfDay
Script: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))

Below is the error:

Request to Elasticsearch failed: {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][0]: SearchParseException[[logstash-2015.04.08][0]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][1]: SearchParseException[[logstash-2015.04.08][1]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][2]: SearchParseException[[logstash-2015.04.08][2]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][3]: SearchParseException[[logstash-2015.04.08][3]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][4]: SearchParseException[[logstash-2015.04.08][4]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":"*"}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }]"}KbnError@http://localhost:5601/index.js?_b=5930:39210:21
RequestFailure@http://localhost:5601/index.js?_b=5930:39247:1
callResponseHandlers/<@http://localhost:5601/index.js?_b=5930:42978:38
Promise.try@http://localhost:5601/index.js?_b=5930:46205:23
Promise.map/<@http://localhost:5601/index.js?_b=5930:46183:16
Promise.map@http://localhost:5601/index.js?_b=5930:46182:26
callResponseHandlers@http://localhost:5601/index.js?_b=5930:42950:1
fetchWithStrategy/<@http://localhost:5601/index.js?_b=5930:43068:16
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31
qFactory/ref/<.then/<@http://localhost:5601/index.js?_b=5930:20959:26
$RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:5601/index.js?_b=5930:22002:16
$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:5601/index.js?_b=5930:21814:15
$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:5601/index.js?_b=5930:22106:13
done@http://localhost:5601/index.js?_b=5930:17641:34
completeRequest@http://localhost:5601/index.js?_b=5930:17855:7
createHttpBackend/</xhr.onreadystatechange@http://localhost:5601/index.js?_b=5930:17794:1

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d7b2e870-a08e-4944-8203-dca08df62de0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

The same problem here. elasticsearch 1.5.1-1 on Arch Linux community.
Were you able to make it work yet?

On Thursday, April 9, 2015 at 2:21:10 AM UTC+2, ashish kudva wrote:

Hello,

I am trying to add a manually created scripted field using the dropdown
box withing Aggregation:

Any pointers on how to resolve this error would be very helpful.

Scriped field:
Name: @hourOfDay
Script: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))

Below is the error:

Request to Elasticsearch failed: {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][0]: SearchParseException[[logstash-2015.04.08][0]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][1]: SearchParseException[[logstash-2015.04.08][1]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][2]: SearchParseException[[logstash-2015.04.08][2]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][3]: SearchParseException[[logstash-2015.04.08][3]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][4]: SearchParseException[[logstash-2015.04.08][4]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":"*"}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }]"}KbnError@http://localhost:5601/index.js?_b=5930:39210:21
RequestFailure@http://localhost:5601/index.js?_b=5930:39247:1
callResponseHandlers/ http://localhost:5601/index.js?_b=5930:39247:1callResponseHandlers/<@http://localhost:5601/index.js?_b=5930:42978:38
Promise.try@http://localhost:5601/index.js?_b=5930:46205:23
Promise.map/<@http://localhost:5601/index.js?_b=5930:46183:16
Promise.map@http://localhost:5601/index.js?_b=5930:46182:26
callResponseHandlers@http://localhost:5601/index.js?_b=5930:42950:1
fetchWithStrategy/ http://localhost:5601/index.js?_b=5930:42950:1fetchWithStrategy/<@http://localhost:5601/index.js?_b=5930:43068:16
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31
qFactory/ref/ http://localhost:5601/index.js?_b=5930:43068:16qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31qFactory/ref/<.then/<@http://localhost:5601/index.js?_b=5930:20959:26
$RootScopeProvider/this.$get http://localhost:5601/index.js?_b=5930:20959:26$RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:5601/index.js?_b=5930:22002:16
$RootScopeProvider/this.$get http://localhost:5601/index.js?_b=5930:22002:16$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:5601/index.js?_b=5930:21814:15
$RootScopeProvider/this.$get http://localhost:5601/index.js?_b=5930:21814:15$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:5601/index.js?_b=5930:22106:13
done@http://localhost:5601/index.js?_b=5930:17641:34
completeRequest@http://localhost:5601/index.js?_b=5930:17855:7
createHttpBackend/ http://localhost:5601/index.js?_b=5930:17855:7createHttpBackend/</xhr.onreadystatechange@http://localhost:5601/index.js?_b=5930:17794:1

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/65d77d99-23b8-4c5e-bab1-3eacae055833%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I've asked on IRC and got this:
"Unfortunatly that feature was removed due to a security issue with Groovy.
For now you can only use Lucene Expressions for scripted fields. We are
working to try and get the date functionality back."

On Thursday, April 9, 2015 at 2:21:10 AM UTC+2, ashish kudva wrote:

Hello,

I am trying to add a manually created scripted field using the dropdown
box withing Aggregation:

Any pointers on how to resolve this error would be very helpful.

Scriped field:
Name: @hourOfDay
Script: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))

Below is the error:

Request to Elasticsearch failed: {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][0]: SearchParseException[[logstash-2015.04.08][0]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][1]: SearchParseException[[logstash-2015.04.08][1]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][2]: SearchParseException[[logstash-2015.04.08][2]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][3]: SearchParseException[[logstash-2015.04.08][3]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][4]: SearchParseException[[logstash-2015.04.08][4]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":"*"}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }]"}KbnError@http://localhost:5601/index.js?_b=5930:39210:21
RequestFailure@http://localhost:5601/index.js?_b=5930:39247:1
callResponseHandlers/ http://localhost:5601/index.js?_b=5930:39247:1callResponseHandlers/<@http://localhost:5601/index.js?_b=5930:42978:38
Promise.try@http://localhost:5601/index.js?_b=5930:46205:23
Promise.map/<@http://localhost:5601/index.js?_b=5930:46183:16
Promise.map@http://localhost:5601/index.js?_b=5930:46182:26
callResponseHandlers@http://localhost:5601/index.js?_b=5930:42950:1
fetchWithStrategy/ http://localhost:5601/index.js?_b=5930:42950:1fetchWithStrategy/<@http://localhost:5601/index.js?_b=5930:43068:16
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31
qFactory/ref/ http://localhost:5601/index.js?_b=5930:43068:16qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31qFactory/ref/<.then/<@http://localhost:5601/index.js?_b=5930:20959:26
$RootScopeProvider/this.$get http://localhost:5601/index.js?_b=5930:20959:26$RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:5601/index.js?_b=5930:22002:16
$RootScopeProvider/this.$get http://localhost:5601/index.js?_b=5930:22002:16$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:5601/index.js?_b=5930:21814:15
$RootScopeProvider/this.$get http://localhost:5601/index.js?_b=5930:21814:15$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:5601/index.js?_b=5930:22106:13
done@http://localhost:5601/index.js?_b=5930:17641:34
completeRequest@http://localhost:5601/index.js?_b=5930:17855:7
createHttpBackend/ http://localhost:5601/index.js?_b=5930:17855:7createHttpBackend/</xhr.onreadystatechange@http://localhost:5601/index.js?_b=5930:17794:1

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0c630d18-07c9-43a0-a029-6aaeb7c603dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks for letting me know. Appreciate it.

For my future reference to ask such questions, can you us know which irc
channel did you post that question?

On Sunday, April 19, 2015 at 5:25:03 PM UTC-5, ke...@reversity.org wrote:

I've asked on IRC and got this:
"Unfortunatly that feature was removed due to a security issue with
Groovy. For now you can only use Lucene Expressions for scripted fields. We
are working to try and get the date functionality back."

On Thursday, April 9, 2015 at 2:21:10 AM UTC+2, ashish kudva wrote:

Hello,

I am trying to add a manually created scripted field using the dropdown
box withing Aggregation:

Any pointers on how to resolve this error would be very helpful.

Scriped field:
Name: @hourOfDay
Script: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))

Below is the error:

Request to Elasticsearch failed: {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][0]: SearchParseException[[logstash-2015.04.08][0]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][1]: SearchParseException[[logstash-2015.04.08][1]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][2]: SearchParseException[[logstash-2015.04.08][2]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][3]: SearchParseException[[logstash-2015.04.08][3]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }{[qsuoq24rQCmt-BkEuwe1tg][logstash-2015.04.08][4]: SearchParseException[[logstash-2015.04.08][4]: query[ConstantScore(BooleanFilter(+cache(@timestamp:[1428465600000 TO 1428551999999])))],from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":"*"}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1428465600000,"lte":1428551999999}}}],"must_not":[]}}}},"aggs":{"2":{"histogram":{"script":"Integer.parseInt(new Date(doc[\"@timestamp\"}.value).format(\"H\"))","lang":"expression","interval":1}}}}]]]; nested: ExpressionScriptCompilationException[Failed to parse expression: Integer.parseInt(new Date(doc["@timestamp"}.value).format("H"))]; nested: ParseException[ invalid sequence of tokens near 'Date' at position (21).]; nested: NoViableAltException; }]"}KbnError@http://localhost:5601/index.js?_b=5930:39210:21
RequestFailure@http://localhost:5601/index.js?_b=5930:39247:1
callResponseHandlers/ http://localhost:5601/index.js?_b=5930:39247:1callResponseHandlers/<@http://localhost:5601/index.js?_b=5930:42978:38
Promise.try@http://localhost:5601/index.js?_b=5930:46205:23
Promise.map/<@http://localhost:5601/index.js?_b=5930:46183:16
Promise.map@http://localhost:5601/index.js?_b=5930:46182:26
callResponseHandlers@http://localhost:5601/index.js?_b=5930:42950:1
fetchWithStrategy/ http://localhost:5601/index.js?_b=5930:42950:1fetchWithStrategy/<@http://localhost:5601/index.js?_b=5930:43068:16
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31
qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31
qFactory/ref/ http://localhost:5601/index.js?_b=5930:43068:16qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:5601/index.js?_b=5930:20873:31qFactory/ref/<.then/<@http://localhost:5601/index.js?_b=5930:20959:26
$RootScopeProvider/this.$get http://localhost:5601/index.js?_b=5930:20959:26$RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:5601/index.js?_b=5930:22002:16
$RootScopeProvider/this.$get http://localhost:5601/index.js?_b=5930:22002:16$RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:5601/index.js?_b=5930:21814:15
$RootScopeProvider/this.$get http://localhost:5601/index.js?_b=5930:21814:15$RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:5601/index.js?_b=5930:22106:13
done@http://localhost:5601/index.js?_b=5930:17641:34
completeRequest@http://localhost:5601/index.js?_b=5930:17855:7
createHttpBackend/ http://localhost:5601/index.js?_b=5930:17855:7createHttpBackend/</xhr.onreadystatechange@http://localhost:5601/index.js?_b=5930:17794:1

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7cc9d321-e5e2-4673-96c8-9267bfce24d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.