0
votes

I'm having a complex document in my Cosmos DB like below

{
    "id": "e064a694-8e1e-4660-a3ef-6b894e9414f7",
    "Name": "Lidiya Lawrence",
    "languageBatchResult": {
        "id": "Lidiya Lawrence",
        "Languages": [
            {
                "name": "English"
            }
        ]
    },
    "keyPhraseBatchResult": {
        "Keys": [
            "Government of India",
            "Training Co-ordinator",
            "customer support",
            "months"
        ]
    }
}

I'm trying to implement Azure Search with this data.

The problem is how should I able to create an index as searchable for the keyPhraseBatchResult/Keys which is having the list of values?

I already tried to create an index with keyPhraseBatchResult in azure search but it's not working. The indexing is working only for Name unfortunately

Update 1

After adding the keyphrases how to map the field now?

enter image description here

2

2 Answers

1
votes

To index /keyPhraseBatchResult/Keys, you need to first create a Collection(Edm.String) index field keyphrases to store your list.

Then you need to set up your indexer with a field mapping from /keyPhraseBatchResult/Keys to keyphrases.

0
votes

Modeling/Mapping Complex Types in Indexes Feature is finally implemented by microsoft

As per that, we have 2 new data types called Edm.ComplexType and Collection(Edm.ComplexType) with this we can easily map our indexes

Refer here

[Note: It is start supported by api-version=2019-05-06]