title: Cosmos DB Index size is greater than Data Size
body: <p>I have a partitioned collection in cosmos db with custom indexing policy (approx. 30 include fields) and consistent index mode. When collection data size reached high level was decided to remove some docs (~50k) from collection and move to other storage.</p>
  
  <p>After removal data size reduced significantly but Index size keep the same and even start increasing.. That seems very strange because I expect index size to reduce the same as data size. Isn't it removed when data is removed? Should I do something additional to remove Indexes? Is it even ok that data size is less than index size?</p>
  
  <p>Screenshot for azure collection metrics:<br>
  <a href="https://i.stack.imgur.com/hwnvF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hwnvF.png" alt="enter image description here"></a></p>
  
  <p>Deletion was done by js stored proc</p>
  
  <pre><code>    function bulkDeleteByCondition() {
      var collection = getContext().getCollection();
      var collectionLink = collection.getSelfLink();
      var response = getContext().getResponse();
      var query = "SELECT root._self FROM root";
      var responseBody = {
          deleted: 0,
          continuation: true
      };
  
      tryQueryAndDelete();
  
      function tryQueryAndDelete(continuation) {
          var requestOptions = { continuation: continuation };
  
          var isAccepted = collection.queryDocuments(collectionLink, query, requestOptions, function (err, retrievedDocs, responseOptions) {
              if (err) {
                  throw new Error(`Failed on collection.queryDocuments: ${err} for query ${query}`);
              }
  
              if (retrievedDocs.length &gt; 0) {
                  tryDelete(retrievedDocs);
              } else if (responseOptions.continuation) {.
                  tryQueryAndDelete(responseOptions.continuation);
              } else {
                  responseBody.continuation = false;
                  response.setBody(responseBody);
              }
          });
  
          if (!isAccepted) {
              response.setBody(responseBody);
          }
      }
  
      function tryDelete(documents) {
          if (documents.length &gt; 0) {
              var isAccepted = collection.deleteDocument(documents[0]._self, {}, function (err, responseOptions) {
                  if (err) {
                      throw new Error(`Failed on collection.deleteDocument: ${err} for query ${query}`);
                  }
  
                  responseBody.deleted++;
                  documents.shift();
                  tryDelete(documents);
              });
  
              if (!isAccepted) {
                  response.setBody(responseBody);
              }
          } else {
              tryQueryAndDelete();
          }
      }
      }
  </code></pre>