My documents have a quite deep structure with multilangual options. How would I go about creating a View for this document? Note: I want the “text” properties within the nested “depotProperties --> LocalizedNames” to be searchable (queryable).
I have a collection of depots. The depots can be filtered by the user. The fields we want to be queryable/searchable are the various “depotProperties” (manufacturer, etc). I.e. we need to make the nested “text” fields indexed so we can query them. We don’t know how to set up a view for this…
private void RegisterIndexes()
.SetMap((doc, emit) =>
var localizedNames = doc["localizedNames"] as JArray;
if (localizedNames == null)
foreach (var localizedName in localizedNames)
When I do a query on this (for example; setting the Start- and EndKey to “Manufacturer”) I get the correct documents.
However, when I chose to fetch/query all documents of the type “Depot”, I get one object per emitted, i.e. I get duplicates (“Manufacturer” and “Hersteller” returns in two different objects, even though they belong in the same document).
Is it because my View is faulty, or is this the correct behaviour?
You can include as much data as you want in the value you emit. But a query does a scan of a single index, which has to be sorted by a single criterion, with one key as the primary, and optional secondary, etc. keys (if you use an array.)