Does Azure Cognitive Search support dynamic field mapping?

Andrew Neeson 21 Reputation points
2022-09-05T16:35:58.257+00:00

Does ACS have an equivalent mechanism to Elasticsearch's dynamic field mapping?

I'm porting a platform across from ES that uses it (to allow users to store + search user-defined fields), but I can't find an equivalent mechanism in ACS.

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
830 questions
{count} votes

Accepted answer
  1. Dan Gøran Lunde 96 Reputation points
    2022-09-15T14:14:18.193+00:00

    Here is my model where the value part is multivalue.

        {  
          "name": "Metadata",  
          "type": "Edm.ComplexType",  
          "fields": [  
            {  
              "name": "Properties",  
              "type": "Collection(Edm.ComplexType)",  
              "fields": [  
                {  
                  "name": "Name",  
                  "type": "Edm.String",  
                  "searchable": true,  
                  "filterable": true,  
                  "retrievable": true,  
                  "sortable": false,  
                  "facetable": true,  
                  "key": false,  
                  "indexAnalyzer": null,  
                  "searchAnalyzer": null,  
                  "analyzer": "pattern",  
                  "normalizer": null,  
                  "synonymMaps": []  
                },  
                {  
                  "name": "Values",  
                  "type": "Collection(Edm.String)",  
                  "searchable": true,  
                  "filterable": true,  
                  "retrievable": true,  
                  "sortable": false,  
                  "facetable": true,  
                  "key": false,  
                  "indexAnalyzer": null,  
                  "searchAnalyzer": null,  
                  "analyzer": "pattern",  
                  "normalizer": null,  
                  "synonymMaps": []  
                }  
              ]  
            }  
          ]  
        },  
    
    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Dan Gøran Lunde 96 Reputation points
    2022-09-14T21:57:11.56+00:00

    @Andrew Neeson , yes, you can define your own types that store dynamic data. And you can query against that data later. I have a use case where I need to dynamically map user-defined metadata properties from PDF documents to an item in the Azure Cognitive Search index. I added a property to the item I submit to my index. I'm using our own, custom type to represent the data as a list of keys and values.

        // Dynamic list of properties  
        public KeyValEntryList? Metadata { get; set; } = new KeyValEntryList();  
    

    Any data found in the PDF metadata is mapped against this. You can then query against this as any other complex type.

    2 people found this answer helpful.