I define in the mapping:
"time" : {
"type" : "date",
"format" : "yyyy'M'MM"
},
The field is a date, I can create time histograms. Things look fine in the visualizations, and I can also filter on date. The filter is:
{ "range": { "time": { "format": "epoch_millis", "gte": 1470002400000, "lt": 1472680800000 } } }
In the Discover section, this json also works. However, this lucene syntax throws an error:
time : [1470002400000 TO 1472680800000]
This lucene query works fine on indexes with a standard time format.
The issue is not a problem for me, because json works, but still looks like a bug in the Discover section to me. The error is:
Error: Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"parse_exception","reason":"failed to parse date field [1470002400000] with format [yyyy'M'MM]"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"asylum_appl_monthly_","node":"XKPlioC4RVevWytyI-aGyQ","reason":{"type":"query_shard_exception","reason":"failed to create query: {\n \"query_string\" : {\n \"query\" : \"time : [1470002400000 TO 1472680800000]\",\n \"fields\" : [ ],\n \"use_dis_max\" : true,\n \"tie_breaker\" : 0.0,\n \"default_operator\" : \"or\",\n \"auto_generate_phrase_queries\" : false,\n \"max_determinized_states\" : 10000,\n \"enable_position_increments\" : true,\n \"fuzziness\" : \"AUTO\",\n \"fuzzy_prefix_length\" : 0,\n \"fuzzy_max_expansions\" : 50,\n \"phrase_slop\" : 0,\n \"analyze_wildcard\" : true,\n \"escape\" : false,\n \"split_on_whitespace\" : true,\n \"boost\" : 1.0\n }\n}","index_uuid":"w-LU7xwkTzmJyzekFUUPIg","index":"asylum_appl_monthly_","caused_by":{"type":"parse_exception","reason":"failed to parse date field [1470002400000] with format [yyyy'M'MM]","caused_by":{"type":"illegal_argument_exception","reason":"Parse failure at index [9] of [1470002400000]"}}}}]},"status":400}
KbnError@https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:92:13722
RequestFailure@https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:92:14531
https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/kibana.bundle.js?v=15523:229:30408
https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:91:17547
map@[native code]
map@https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:91:16870
processQueue@https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:38:23623
https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:38:23900
$digest@https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:39:2364
$apply@https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:39:5044
done@https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:37:25033
completeRequest@https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:37:28710
onload@https://31ddbfabcd679aee43b4b24bd2a6f8c4.eu-west-1.aws.found.io:9243/bundles/commons.bundle.js?v=15523:37:29649