none
Azure search indexing null value after adding a column with data in cosmos db RRS feed

  • Question

  • Hi All,
    I have added one json key(column) and its value in azure cosmos db using the below code. The Cosmos DB gets updated correctly. Then i added the same key name in my Azure Search Index Field. However after  running the indexer the key is coming but the vale for that key is coming as null whereas the data is there in cosmos DB

    using (DocumentClient documentClient = new DocumentClient(new Uri("https://xxxxxxxxx.documents.azure.com:443/"), "05Cu4kvPyRShxxxxxxxxsaf2GOVVWxxxxxxxxxxxxxobT5RW3pKVmyyA=="))
                    {
                                                     var docUri = UriFactory.CreateDocumentCollectionUri("dbname", "containername");
                                Document document = await documentClient.ReadDocumentAsync(UriFactory.CreateDocumentUri("dbname", "data", Convert.ToString(drES["Id"])), new RequestOptions { PartitionKey = new PartitionKey(Convert.ToString(drES["PKEY"])) });
                               
                                {
                                  
                                    document.SetPropertyValue("documenttype", "DocValue");
                                    await documentClient.ReplaceDocumentAsync(document);
                                    counter++;
                                }
                            }

    Azure search index data

    "documenttype": null
    },

    Why after indexing the data is coming as null in azure search?


                       
    Wednesday, August 14, 2019 10:59 AM

All replies

  • Azure Search has an implicit dependency on Cosmos DB indexing. If you turn off automatic indexing in Cosmos DB, Azure Search returns a successful state, but fails to index container contents. For instructions on how to check settings and turn on indexing, see Manage indexing in Azure Cosmos DB.

    Please let us know if you have further questions or concerns.

    Thursday, August 15, 2019 8:53 AM
    Moderator