Query index in Cloudant doesn't return expected data
<p>I have a Cloudant DB on Bluemix with an index defined as:</p>

<pre><code>{
 "index": {
  "fields": [
   { "typ": "asc" },
   { "sen": "asc" },
   { "tim": "asc" }
  ]
 },
 "type": "json"
}
</code></pre>

<p>WHen I have a query of the form</p>

<pre><code>{
  "selector": {
    "tim": {"$gt": millisecs},
    "typ": "H"
  },
  "fields": ["sen","val","tim"],
  "sort": [
    { "typ": "asc" },
    { "sen": "asc" },
    { "tim": "asc" }
  ],
  "limit": readCount
}
</code></pre>

<p>it works perfectly. If I want to get everything, i.e. remove the condition <code>typ="H"</code>, I get the error</p>

<blockquote>
  <p>"error":"no_usable_index","reason":"There is no index available for this selector."</p>
</blockquote>

<p>I get the same response if I have <code>"typ" : { "$in": ["H", "T"] }</code>. I would have expected that the more generic query would work better than the one with extra selectors. </p>

<p>I just don't understand how this could be!</p>