MarkLogic - Best solution between collection and index
<p>I have several JSON like that :</p>

<pre><code>[{
    "type": "car",
    "field1": "test"
}, {
    "type": "bike",
    "field1": "test"
}]
</code></pre>

<p>I stored them in MarkLogic 8.4 and I want to perform some search query on them to retrieve documents according to the type (eg : Find all documents with the type "car").</p>

<p>I have two potential solutions :</p>

<ul>
<li>Set Marklogic collections to each document. Example : put "car" and "bike" collection on the example document. In my search query I can add a collection restriction.</li>
<li>Put an index on "type" field of each JSON</li>
</ul>

<p>Is one method is better than another one in term of performances and/or best practices ?</p>

<p>Thanks,
Romain.</p>