<p dir="auto">The <code class="notranslate">range</code> aggregation is awesome, but it currently limits you to defining buckets based on non-obvious inclusive/exclusive terms:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;to&quot; : &quot;2015-01-01&quot;
},
{
  &quot;from&quot; : &quot;2015-01-01&quot;,
  &quot;to&quot; : &quot;2016-01-01&quot;
},
{
  &quot;from&quot; : &quot;2016-01-01&quot;
}"><pre class="notranslate">{
  <span class="pl-ent">"to"</span> : <span class="pl-s"><span class="pl-pds">"</span>2015-01-01<span class="pl-pds">"</span></span>
},
{
  <span class="pl-ent">"from"</span> : <span class="pl-s"><span class="pl-pds">"</span>2015-01-01<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"to"</span> : <span class="pl-s"><span class="pl-pds">"</span>2016-01-01<span class="pl-pds">"</span></span>
},
{
  <span class="pl-ent">"from"</span> : <span class="pl-s"><span class="pl-pds">"</span>2016-01-01<span class="pl-pds">"</span></span>
}</pre></div>
<p dir="auto">It would be great if we changed this to be more along the lines of what we do with the range query:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;lt&quot; : &quot;2015-01-01&quot;
},
{
  &quot;gte&quot; : &quot;2015-01-01&quot;,
  &quot;lt&quot; : &quot;2016-01-01&quot;
},
{
  &quot;gte&quot; : &quot;2016-01-01&quot;
}"><pre class="notranslate">{
  <span class="pl-ent">"lt"</span> : <span class="pl-s"><span class="pl-pds">"</span>2015-01-01<span class="pl-pds">"</span></span>
},
{
  <span class="pl-ent">"gte"</span> : <span class="pl-s"><span class="pl-pds">"</span>2015-01-01<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"lt"</span> : <span class="pl-s"><span class="pl-pds">"</span>2016-01-01<span class="pl-pds">"</span></span>
},
{
  <span class="pl-ent">"gte"</span> : <span class="pl-s"><span class="pl-pds">"</span>2016-01-01<span class="pl-pds">"</span></span>
}</pre></div>
<p dir="auto">At the very least, it's more explicit about what's happening, but it also has the added benefit of matching the behavior of the query <em>and</em> it gives a smidgen more flexibility.</p>
<p dir="auto"><strong>Elasticsearch version</strong>:<br>
2.2.0<br>
<strong>JVM version</strong>:<br>
java version "1.7.0_65"<br>
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)<br>
<strong>OS version</strong>:<br>
Ubuntu 14.04.1 LTS<br>
<strong>Description of the problem including expected versus actual behavior</strong>:<br>
Making a call to analyze API turns into a timeout when the analyzer doesn't exist and no index is provided in the url, if the index is included, the expected error is returned. Tried it in an old 1.3.4 ES server and it returns the expected error quickly.</p>
<p dir="auto"><strong>Steps to reproduce</strong>:<br>
Note i'm using 'standard_s_' analyzer</p>
<ol dir="auto">
<li>curl -XGET '<a href="http://localhost:9200/_analyze?pretty&amp;analyzer=standards&amp;text=this-is-a-test" rel="nofollow">http://localhost:9200/_analyze?pretty&amp;analyzer=standards&amp;text=this-is-a-test</a>'</li>
<li>But this works ok (returns an error): curl -XGET '<a href="http://localhost:9200/my_index/_analyze?pretty&amp;analyzer=standards&amp;text=this-is-a-test" rel="nofollow">http://localhost:9200/my_index/_analyze?pretty&amp;analyzer=standards&amp;text=this-is-a-test</a>'<br>
3.</li>
</ol>
<p dir="auto"><strong>Provide logs (if relevant)</strong>:<br>
This shows in elasticsearch logs everytime i make a request (with no index):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2016-03-08 15:37:31,027][ERROR][transport                ] [mynode] failed to handle exception for action [indices:admin/analyze[s]], handler [org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$1@227981db]
java.lang.NullPointerException
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction.perform(TransportSingleShardAction.java:195)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction.access$700(TransportSingleShardAction.java:115)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$1.handleException(TransportSingleShardAction.java:174)
        at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:821)
        at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:799)
        at org.elasticsearch.transport.TransportService$4.onFailure(TransportService.java:361)
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)"><pre class="notranslate"><code class="notranslate">[2016-03-08 15:37:31,027][ERROR][transport                ] [mynode] failed to handle exception for action [indices:admin/analyze[s]], handler [org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$1@227981db]
java.lang.NullPointerException
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction.perform(TransportSingleShardAction.java:195)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction.access$700(TransportSingleShardAction.java:115)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$AsyncSingleAction$1.handleException(TransportSingleShardAction.java:174)
        at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:821)
        at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:799)
        at org.elasticsearch.transport.TransportService$4.onFailure(TransportService.java:361)
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
</code></pre></div>
<p dir="auto">When making the request to the index the stacktrace is the following:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2016-03-08 16:07:32,495][DEBUG][action.admin.indices.analyze] [mynode] null: failed to execute [org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest@1c344de9]
RemoteTransportException[[mynode][my_ip:9300][indices:admin/analyze[s]]]; nested: IllegalArgumentException[failed to find analyzer [standards]];
Caused by: java.lang.IllegalArgumentException: failed to find analyzer [standards]
        at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:143)
        at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:63)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:282)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:275)
        at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.doRun(MessageChannelHandler.java:299)
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
[2016-03-08 16:07:32,496][INFO ][rest.suppressed          ] /my_index/_analyze Params: {index=my_index, text=this-is-a-test, analyzer=standards, pretty=}
RemoteTransportException[[mynode][my_ip:9300][indices:admin/analyze[s]]]; nested: IllegalArgumentException[failed to find analyzer [standards]];
Caused by: java.lang.IllegalArgumentException: failed to find analyzer [standards]
        at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:143)
        at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:63)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:282)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:275)
        at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.doRun(MessageChannelHandler.java:299)
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)"><pre class="notranslate"><code class="notranslate">[2016-03-08 16:07:32,495][DEBUG][action.admin.indices.analyze] [mynode] null: failed to execute [org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest@1c344de9]
RemoteTransportException[[mynode][my_ip:9300][indices:admin/analyze[s]]]; nested: IllegalArgumentException[failed to find analyzer [standards]];
Caused by: java.lang.IllegalArgumentException: failed to find analyzer [standards]
        at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:143)
        at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:63)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:282)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:275)
        at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.doRun(MessageChannelHandler.java:299)
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
[2016-03-08 16:07:32,496][INFO ][rest.suppressed          ] /my_index/_analyze Params: {index=my_index, text=this-is-a-test, analyzer=standards, pretty=}
RemoteTransportException[[mynode][my_ip:9300][indices:admin/analyze[s]]]; nested: IllegalArgumentException[failed to find analyzer [standards]];
Caused by: java.lang.IllegalArgumentException: failed to find analyzer [standards]
        at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:143)
        at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:63)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:282)
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:275)
        at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.doRun(MessageChannelHandler.java:299)
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
</code></pre></div>