I have a Azure Cognitive Search set up with two DataSources, two Indexers indexing those DataSources and one Index.
I'd like to be able to able to query/filter by DataSource. Is that possible?
Off of @Derek Legenzoff serve this is how I did it...
Add all your datasources
Create skillsets
for each one data source with the following skill
{
"@odata.type": "#Microsoft.Skills.Util.ConditionalSkill",
"name": "#1",
"description": "",
"context": "/document",
"inputs": [
{
"name": "condition",
"source": "= true"
},
{
"name": "whenTrue",
"source": "= 'Production'" //name of your environment
},
{
"name": "whenFalse",
"source": "= ''"
}
],
"outputs": [
{
"name": "output",
"targetName": "Env"
}
]
}
Create single index
for your data model and add a Env
field, and it's filterable and queryable
Create indexers
for each one of your data sources that point to the index
from step 3 and datasource
from step 1
IMPORTANT: make sure you indexers have the following code in the definition.
"outputFieldMappings": [
{
"sourceFieldName": "/document/Env",
"targetFieldName": "Env"
}
],
This will connect the product of the skill
to the index