简体   繁体   中英

How to set a value in a list as the key for Azure Cognitive Search

The data I have is of the form {"event": {"custom": {"dimensions": [{"Id": ....}, {},...{}]}, ...},...} The key that I need to index by is in the list. However, Cognitive Search does not seem to let me access the value within the list. Azure Cog. Search also fails to access any content from the list while trying to index. Are there any solutions you can think?

Not sure how you're trying, but Azure Cognitive Search supports Complex types. Take a look in the following link:

https://docs.microsoft.com/en-us/azure/search/search-howto-complex-data-types

As an Alternative, you can project the internal dimensions (assuming they have a fixed number of dimensions) to fields in your index.

When using Indexers to import the data, key fields are limited to what can be expressed in a field mapping which has some support for mapping functions but wont allow you to select a value of an object in a collection. Your only options are to pre-process and transform the data (such as a query if this is coming from Cosmos DB, or azure function trigger if coming from blobs) or use a different field as the id and put the dimension id in another field that is queryable.

To make the data queryable you can use complex types or if the dimensions are always in the same ordinal you can use output field mappings to map it to a field by collection ordinal such as /document/event/custom/dimensions/1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM