I have an Azure Cognitive Search index which indexes data from multiple data sources. Each data source is indexed with a near identical indexer. Each indexer calls the same skillset configuration.
Within the index definition I have a field labeled "datasource" which is intended to identify the data source for a particular document. I would like to have the indexer or use a modular skill, such as a conditional skill, to set the value of this field based on the data source. I understand it is possible to use a conditional skill to the value of a field if a value is not found, but I want to avoid having to create a new skillset for every indexer. My data sources are documents of multiple types in blob containers.
Using only the indexer definition is is possible to assign the value of a field to a string manually in the definition, by somehow extracting the name of the data source, or using a modular skill in the skillset definition?
An avenue I have been pursuing is setting user-specified blob metadata at the container level. However, I have not been able to successfully retrieve this information with either the indexer or skillset. I do not want to set this user-specified blob metadata on every single blob in a container.
Unfortunately it is not possible to configure a blob data source in a way that will pass unique information to the skillset. Having a separate skillset per datasource may be the cleanest option. Alternatively, you could pass metadata_storage_path to a custom skill and parse the container path to return a value by convention or mapping.
Related
I have 3 different indexes, and I want to combine into one. Is there anyway we can combine multiple indexes into one index, so that I can search that single index.
Yes, but how you do it depends on what data sources you are using and how you set them up.
You can define a data source, indexer and index via the portal. You can have multiple data sources/indexers for a single index, but you need to use the REST API to set this up as explained here. You cannot do this via the user interface in the Azure Portal.
See a previous post from 2016 about multiple indexers per index: Azure search: use a single index on multiple data sources
I have 500+ articles with Images, I want to retrieve those articles with images and show the same in in chatbot using Microsoft bot Framework and Azure Search. But, Azure search isn't able to index images. In this scenario where do I need to store these images, how do I map these images to appropriate article?
You can either populate the documents in the index via code or use an indexer that can create your documents. Here is the Indexer data source drop down showing the different data sources available.
You could put the information about the image and a path to the image in any of these data sources and have an indexer pick it up and create your documents within the index.
If you don't want to use a formal database, you could also upload your images into blob storage and decorate each blob with custom metadata. When creating your index with an indexer, it will find the custom metadata and it can become fields on documents within your index.
There are lots of options, but my advice is to keep your documents within your index as small as possible to control your costs. That's usually done by having as few a fields as possible and have fields that reference where the stuff is located. The documents within an index are for discovering where things are located and NOT for storing the actual data. When you index start occupying lots of space, your cost will go up a LOT.
Solr (among others) permits fields to be indexed, but not stored. Unless I’ve missed something in the documentation, Azure Search doesn’t appear to support this option.
It does have an attribute called retrievable, but it states
Currently, selecting this attribute does not cause a measurable increase in index storage requirements.
This suggests to me that Azure Search is storing everything anyway, and perhaps enabling toggling of this behaviour in-place?
My question is, how can I define a field in an equivalent way to stored=false in Azure Search?
As MatsLindh said, in Azure Search, an index is a persistent store of documents and other constructs used for filtered and full text search on an Azure Search service. So, you could not define a field to store=false.
According to that you have a large index, one of the simplest mechanisms is to submit multiple documents or records in a single request.
Note: To keep document size down, remember to exclude non-queryable data from the request. Images and other binary data are not directly searchable and shouldn't be stored in the index. To integrate non-queryable data into search results, you should define a non-searchable field that stores a URL reference to the resource.
For more details about indexing large data sets in Azure Search, you could refer to this article.
Is it possible to merge multiple blob into a single Azure Search record?
Complete Scenario: We have list of companies stored as json in cosmosDB and its related documents(.docx/pdf) in blob storage. A company can have multiple documents with varying size up to 20 MB and there is no upper limit of number of documents. How can we merge content of all documents and push into 'content' field of Azure Search Index, so that we could perform full-text search in companies data coming from cosmos and blob.
I've looked into https://www.lytzen.name/2017/01/30/combine-documents-with-other-data-in.html - Scenario discuss in the tutorial has one-to-one relationship between candidate data and CV. In our case there is one-to-many relationship between company and its documents.
Any help / direction would be appreciated.
Thanks
Azure Search Blob Indexer maps each blob to a document in the search index 1:1. At the moment, there isn't a way to merge the content of multiple blobs into a single document automatically. However, you can always write a client application that does this and pushes the aggregated content to the Azure Search index using our SDK or REST API..
I'm curious to learn more about scenario. With a single document in the index per company, you won't be able to search for individual documents from blob storage. Is that what want?
It is possible to merge data from different datasources into a single document in a search index, as long as you're trying to "assemble" a document from multiple fields and not merging into a single field.
Note that:
All the datasources agree on what the document key is. By default, the key is blob path. Since path are unique across blobs, the need to agree on keys means that you need to set a metadata property on your "secondary" blobs that correlates them with the "primary" blob.
You can't use indexers to merge multiple source documents into a single index field such as content. Likely, this is not what you need anyway for JSON metadata stored in Cosmos DB, since you probably want to capture that metadata into its own set of fields. For merging into the content field, you would need to write your own merging logic as noted in the previous response.
It seems that the fundamental primitive that would make your scenario "just work" is collection merge - you would model content not as a string, but as a collection of strings, where each element is extracted from one of your blobs. Please feel free to add a suggestion for collection merge functionality to our UserVoice.
One solution that I found is to compress the documents into ZIP and pass ZIP file to Azure Search indexer. Only problem with this solution is that I have to add another processing step for ZIP creation and additional storage cost for keeping ZIP
I have a need to query JSON data stored in Azure blob storage, for operations of filtering (on data types text, data and int), paging (i.e. a functionality similar to skip and take).
The problem my JSON structure is that there is no specific format of JSON data (key/value pair) and is dynamic . Hence the key/value pair of one JSOn result data can differ from another JSOn result data.
Can Azure search help in building indexes on such dynamic JSOn data so that the same can be queried or is there another preferred way?
Take a look at this https://learn.microsoft.com/en-us/azure/search/search-howto-index-json-blobs maybe it can help you.
Other option might be to export json from blob storage into Azure SQL Database or DocumentDB (maybe not everything - if you can you can export just part of data that you need) and query it there.
If you only need filtering like exact matches and numerical comparisons, then a document database such as DocumentDB may be a better choice than Azure Search.
Azure Search excels in linguistically aware full text search (including things like dealing with inflected word forms, misspellings, fuzzy matching, etc.)
As Jovan pointed out, the options are not mutually exclusive - you can use DocumentDB as the primary store and Azure Search for full text search scenarios (getting data from DocumentDB using DocumentDB indexer if necessary).