title: Including and excluding indexes in Elasticsearch query
body: <p>I have the following Elasticsearch query.</p>
  
  <pre><code>GET /index1,index2/type1,type2/_search?q=programming
  </code></pre>
  
  <p>Let's say that I want to exclude <code>index2</code> from this search query. The <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html#multi-index" rel="noreferrer">documentation states the following</a>:</p>
  
  <blockquote>
    <p>It also support wildcards, for example: test*, and the ability to
    "add" (+) and "remove" (-), for example: +test*,-test3.</p>
  </blockquote>
  
  <p>As far as I understand, I should be able to do the following.</p>
  
  <pre><code>GET /+index1,-index2/type1,type2/_search?q=programming
  </code></pre>
  
  <p>However, I get the below error.</p>
  
  <pre><code>{
    "error": {
      "root_cause": [
        {
          "type": "index_not_found_exception",
          "reason": "no such index",
          "resource.type": "index_or_alias",
          "resource.id": " index1",
          "index": " index1"
        }
      ],
      "type": "index_not_found_exception",
      "reason": "no such index",
      "resource.type": "index_or_alias",
      "resource.id": " index1",
      "index": " index1"
    },
    "status": 404
  }
  </code></pre>
  
  <p>If I remove the plus and minus signs, the query runs fine. If I add a wildcard, it seems to work, e.g. the below query.</p>
  
  <pre><code>GET /index1,-*index2/type1,type2/_search?q=programming
  </code></pre>
  
  <p>However, that's not really what I want.</p>
  
  <p>Why is my query not working when I use plus and minus signs to include or exclude indexes as the documentation states? Am I misunderstanding something?</p>
  
  <p>I am using Elasticsearch 2.1.</p>