Dynamically assign documents to a collection, based on the needs of a particular document or indexing request.
If you choose to use a datasource for indexing, that datasource has an associated index pipeline as well as an associated collection to which the index pipeline outputs. By default, datasources are contained within a collection and cannot be accessed from outside collections.
Some scenarios warrant the need for Fusion to assign a document to a collection based on data within that document.
Fusion 4.x or Fusion 5.x
Solution and Guide:
An index profile is also a simple way to use one index pipeline for multiple collections, without any one collection "owning" the pipeline. Then, you can choose to assign documents to a collection without all documents sent to that index profile going into that collection.
Associating an index profile with an index pipeline, or an index pipeline and a collection, is simply a mapping used for reference.
Here are the instructions for recreating this example:
1. Create a an index profile - choose the pipeline which you will be using to index to all collections
var new_collection = ctx.setProperty('collection','COLLECTION_NAMEl');
replace COLLECTION_NAME with the collection to which you'd like to index. You can then use logic, such as reading a particular field for a document, to make the determination of which collection to assign the document to.
3. Save the index pipeline
4. Send documents to the index profile endpoint and verify that they index to the collection that you specified.