Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date histogram fails to select new date range if date is scripted field #24891

Closed
Hohol opened this issue Oct 31, 2018 · 9 comments · Fixed by #25379
Closed

Date histogram fails to select new date range if date is scripted field #24891

Hohol opened this issue Oct 31, 2018 · 9 comments · Fixed by #25379
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@Hohol
Copy link
Contributor

Hohol commented Oct 31, 2018

Kibana version: 6.4.2

Elasticsearch version: 6.4.2

Server OS version: Windows 10 Enterprise

Browser version: Chrome

Original install method: download page

Describe the bug: If you have date histogram where date is scripted field, visualization fails when you try to select date range twice.

Steps to reproduce:

  1. Add documents to Elasticsearch
POST /_bulk
{"create": { "_index": "test", "_id": 1}}
{"timestamp": 1553076734409}
{"create": { "_index": "test", "_id": 2}}
{"timestamp": 1553076674409}
{"create": { "_index": "test", "_id": 3}}
{"timestamp": 1553076614409}
...1000 entries

data.txt

  1. Create new scripted field.
    Name: date, Language: painless, type: date, Format: default, Script: return doc['timestamp'].value
  2. Create new Vertical Bar Chart.
    Aggregation: Date Histogram, Field: date, Interval: Hourly. Apply changes.
  3. Select some date range using mouse. Chart updates successfully.
  4. Select some date range again. Chart does not update. Popup appears with the text
Error in visualization
Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"script_exception","reason":"runtime error","script_stack":["return s.get() >= v} boolean lt(Supplier s, def v) {"," ^---- HERE"],"script":"boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt)","lang":"painless"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"test","node":"JjmpO3sdR7WtKQ7rFIi3Wg","reason":{"type":"script_exception","reason":"runtime error","script_stack":["return s.get() >= v} boolean lt(Supplier s, def v) {"," ^---- HERE"],"script":"boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt)","lang":"painless","caused_by":{"type":"class_cast_exception","reason":"Cannot apply [>] operation to types [java.lang.Long] and [java.lang.String]."}}}]},"status":500}

Screenshots (if relevant):
scripted field
hist 2
error

Errors in browser console (if relevant):

RequestFailure {message: "Request to Elasticsearch failed: {"error":{"root_c…Long] and [java.lang.String]."}}}]},"status":500}", origError: false, resp: {…}, stack: "Error: Request to Elasticsearch failed: {"error":{…ocalhost:5601/bundles/vendors.bundle.js:211:67265"} "Possibly unhandled rejection: {"message":"Request to Elasticsearch failed: {\"error\":{\"root_cause\":[{\"type\":\"script_exception\",\"reason\":\"runtime error\",\"script_stack\":[\"return s.get() >= v} boolean lt(Supplier s, def v) {\",\"        ^---- HERE\"],\"script\":\"boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt)\",\"lang\":\"painless\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"test\",\"node\":\"JjmpO3sdR7WtKQ7rFIi3Wg\",\"reason\":{\"type\":\"script_exception\",\"reason\":\"runtime error\",\"script_stack\":[\"return s.get() >= v} boolean lt(Supplier s, def v) {\",\"        ^---- HERE\"],\"script\":\"boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt)\",\"lang\":\"painless\",\"caused_by\":{\"type\":\"class_cast_exception\",\"reason\":\"Cannot apply [>] operation to types [java.lang.Long] and [java.lang.String].\"}}}]},\"status\":500}","origError":false,"resp":{"error":{"root_cause":[{"type":"script_exception","reason":"runtime error","script_stack":["return s.get() >= v} boolean lt(Supplier s, def v) {","        ^---- HERE"],"script":"boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt)","lang":"painless"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"test","node":"JjmpO3sdR7WtKQ7rFIi3Wg","reason":{"type":"script_exception","reason":"runtime error","script_stack":["return s.get() >= v} boolean lt(Supplier s, def v) {","        ^---- HERE"],"script":"boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt)","lang":"painless","caused_by":{"type":"class_cast_exception","reason":"Cannot apply [>] operation to types [java.lang.Long] and [java.lang.String]."}}}]},"status":500}}"

Provide logs and/or server output (if relevant):

[2018-10-31T13:11:56,261][DEBUG][o.e.a.s.TransportSearchAction] [JjmpO3s] [test][3], node[JjmpO3sdR7WtKQ7rFIi3Wg], [P], s[STARTED], a[id=eFSFfLAIQe2eRf_pO3k1Pw]: Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[test], indicesOptions=IndicesOptions[ignore_unavailable=true, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_aliases_to_multiple_indices=true, forbid_closed_indices=true, ignore_aliases=false], types=[], routing='null', preference='1540977082111', requestCache=null, scroll=null, maxConcurrentShardRequests=5, batchedReduceSize=512, preFilterShardSize=64, allowPartialSearchResults=true, source={"size":0,"query":{"bool":{"must":[{"match_all":{"boost":1.0}},{"script":{"script":{"source":"boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt)","lang":"painless","params":{"lt":"2018-10-31T05:57:47.466Z","gte":"2018-10-30T15:59:27.714Z","value":">=October 30th 2018, 19:55:10.185 <October 31st 2018, 10:57:27.744"}},"boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},"_source":{"includes":[],"excludes":[]},"stored_fields":"*","docvalue_fields":[],"script_fields":{"date":{"script":{"source":"return doc['timestamp'].value","lang":"painless"},"ignore_failure":false}},"aggregations":{"2":{"date_histogram":{"script":{"source":"return doc['timestamp'].value","lang":"painless"},"time_zone":"Asia/Dubai","interval":"1h","offset":0,"order":{"_key":"asc"},"keyed":false,"min_doc_count":1}}}}}]
org.elasticsearch.transport.RemoteTransportException: [JjmpO3s][127.0.0.1:9300][indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Query Failed [Failed to execute main query]
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:298) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:107) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:324) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:357) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:333) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:329) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$3.doRun(SearchService.java:1019) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.4.2.jar:6.4.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
Caused by: org.elasticsearch.script.ScriptException: runtime error
        at org.elasticsearch.painless.PainlessScript.convertToScriptException(PainlessScript.java:94) ~[?:?]
        at org.elasticsearch.painless.PainlessScript$Script.execute(boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt):214) ~[?:?]
        at org.elasticsearch.index.query.ScriptQueryBuilder$ScriptQuery$1$1.matches(ScriptQueryBuilder.java:187) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.apache.lucene.search.ConjunctionDISI$ConjunctionTwoPhaseIterator.matches(ConjunctionDISI.java:345) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:270) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:214) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:662) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:191) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:463) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:266) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:107) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:324) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:357) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:333) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:329) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$3.doRun(SearchService.java:1019) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.4.2.jar:6.4.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_181]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_181]
        at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_181]
Caused by: java.lang.ClassCastException: Cannot apply [>] operation to types [java.lang.Long] and [java.lang.String].
        at org.elasticsearch.painless.DefMath.gte(DefMath.java:819) ~[?:?]
        at org.elasticsearch.painless.PainlessScript$Script.gte(boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt):41) ~[?:?]
        at org.elasticsearch.painless.PainlessScript$Script.execute(boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt):155) ~[?:?]
        at org.elasticsearch.index.query.ScriptQueryBuilder$ScriptQuery$1$1.matches(ScriptQueryBuilder.java:187) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.apache.lucene.search.ConjunctionDISI$ConjunctionTwoPhaseIterator.matches(ConjunctionDISI.java:345) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:270) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:214) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:662) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:191) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:463) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:266) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:107) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:324) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:357) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:333) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:329) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$3.doRun(SearchService.java:1019) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.4.2.jar:6.4.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_181]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_181]
        at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_181]
[2018-10-31T13:11:56,275][DEBUG][o.e.a.s.TransportSearchAction] [JjmpO3s] All shards failed for phase: [query]
org.elasticsearch.script.ScriptException: runtime error
        at org.elasticsearch.painless.PainlessScript.convertToScriptException(PainlessScript.java:94) ~[?:?]
        at org.elasticsearch.painless.PainlessScript$Script.execute(boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt):214) ~[?:?]
        at org.elasticsearch.index.query.ScriptQueryBuilder$ScriptQuery$1$1.matches(ScriptQueryBuilder.java:187) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.apache.lucene.search.ConjunctionDISI$ConjunctionTwoPhaseIterator.matches(ConjunctionDISI.java:345) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:270) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:214) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:662) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:191) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:463) ~[lucene-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:51:45]
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:266) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:107) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:324) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:357) ~[elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:333) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:329) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.search.SearchService$3.doRun(SearchService.java:1019) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41) [elasticsearch-6.4.2.jar:6.4.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.4.2.jar:6.4.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
Caused by: java.lang.ClassCastException: Cannot apply [>] operation to types [java.lang.Long] and [java.lang.String].
        at org.elasticsearch.painless.DefMath.gte(DefMath.java:819) ~[?:?]
        at org.elasticsearch.painless.PainlessScript$Script.gte(boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt):41) ~[?:?]
        at org.elasticsearch.painless.PainlessScript$Script.execute(boolean gte(Supplier s, def v) {return s.get() >= v} boolean lt(Supplier s, def v) {return s.get() < v}gte(() -> { return doc['timestamp'].value }, params.gte) && lt(() -> { return doc['timestamp'].value }, params.lt):155) ~[?:?]
        ... 22 more
@Hohol
Copy link
Contributor Author

Hohol commented Oct 31, 2018

I'd like to try to work on this issue.
Is it OK?
If it is, could anyone give me some recommendation, where should I dig?

@Hohol Hohol closed this as completed Oct 31, 2018
@Hohol Hohol reopened this Oct 31, 2018
@Hohol
Copy link
Contributor Author

Hohol commented Oct 31, 2018

First query parameters:

 "params":{
    "gte":1540914910185,
    "lt":1540969047744,
    "value":">=October 30th 2018, 19:55:10.185 <October 31st 2018, 10:57:27.744"
 },

Second query parameters:

"params":{  
    "gte":"2018-10-30T15:56:06.716Z",
    "lt":"2018-10-31T05:58:37.716Z",
    "value":">=October 30th 2018, 19:55:10.185 <October 31st 2018, 10:57:27.744"
 }

For some reason, second query switched to using string representation of date, instead of timestamp.

@thomasneirynck thomasneirynck added bug Fixes for quality problems that affect the customer experience triage_needed Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Oct 31, 2018
@Hohol
Copy link
Contributor Author

Hohol commented Nov 13, 2018

@thomasneirynck @cjcenizal could someone review my PR?
#25379

@Hohol
Copy link
Contributor Author

Hohol commented Mar 20, 2019

I tried to update my pull request. But it seems something has changed and now scripted field filtering is broken in a new way.
Now even first request contains "gte" and "lt" fields with string representation of date instead of timestamp number. So even first range selection fails.

@Hohol
Copy link
Contributor Author

Hohol commented Mar 20, 2019

@markov00, I'd like to continue working on it. Could you please assign me to this task?

@markov00
Copy link
Member

Done! Thanks @Hohol for your efforts on this

@Hohol
Copy link
Contributor Author

Hohol commented Apr 1, 2019

It seems change in this PR is conflicting with scripted date field filtering
#31807

in brush_event.js file

      range = {
        gte: moment(min).toISOString(),
        lt: moment(max).toISOString(),
        format: 'strict_date_optional_time'
      };

It changed date format to string, but scripted date filtering requires timestamps.

@flash1293, could you please explain, why can't we continue using timestamps here?
I've just tried it with 'epoch_millis' format and with dates before the epoch. It worked fine for me.

@flash1293
Copy link
Contributor

Hi @Hohol This was changed because epoch_millis don't allow dates before the unix epoch anymore which would break Kibana for all data which predates 1970 elastic/elasticsearch#39375

@Hohol
Copy link
Contributor Author

Hohol commented Apr 1, 2019

@flash1293, wow, it's sad. Forbidding negative timestamps and forcing us to use strings instead feels weird to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants