How can I dynamically assign documents to collections?
Some scenarios warrant the need for Fusion datasource indexing. Similarly, there are some use cases in which a datasource may not be needed for indexing. In the latter case, you might have your documents pushed directly to the Fusion index pipelines via the Index Pipelines REST-API.
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.
If you choose to send your documents directly to an index pipeline outside the current pipeline, the request path would look like this:
The collection to which the pipeline outputs is declared in the API request. This allows for more control over dynamically assigning documents to certain collections.
Here are the instructions for recreating this example:
1. Create a push datasource - 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.
3. Save the index pipeline
4. Send documents to the push connector endpoint and verify that they index to the collection that you specified in step 2