0
votes

I already set up DocumentDb and uploaded the documents to DocumentDb.

My JSON documents have data nested upto 4 levels, eg:-

{
  id: '12345',
  properties:
  {
      Accessories:
      {
            watch:1,
            WristBands: [{
                  blue:1, 
                  red: 2}]
                  }
            }
  Name: Leo,
  Age: 24
}

I want to use azure search service for able to search upto the last level(e.g. The count of wristband colour i.e. blue:1). I have setup the service as well.

I want some help in creating the index and the indexer for such nested data in C# so that I can query the service. Already found, how to use DataType.Collection(DataType.String), but this supports till level 2.

Classes can also be made for each sub-level but have no idea how to define them during indexing. Refered to example https://github.com/Azure-Samples/search-dotnet-getting-started .

2

2 Answers

0
votes

Unfortunately, Azure Search does not support nested documents. As you can see from our Uservoice page, this by far the most requested feature so it is something that we are very interested in adding (please cast your vote here if you don't mind). Unfortunately, we do not yet have a timeline on when we will have it implemented yet.

In the meantime, for some applications it is realistic to either flatten the JSON documents or to leverage collection types. For more details on flattening documents, Kirk Evans has a really good blog post on the topic.

0
votes

One more tutorial on setting up Azure Search indexer for DocumentDB: https://azure.microsoft.com/en-us/documentation/articles/documentdb-search-indexer/.

+1 on Kirk Evans' blog post, which shows how to flatten the JSON document. The idea is to leverage the optional query property under container in the data source creation request, and use a join query in that place.