I am working on an application that uses RavenDB on the back. This is my first time using Raven and I am struggling with Map / Reduce.
I read the doc , but unfortunately I do not get anywhere else in the process.
Basically, I have thousands of such documents.
{ ..... "Severity": { "Code": 6, "Data": "Info" }, "Facility": { "Code": 16, "Data": "Local Use 0 (local0)" }, ..... }
And from this, I need to make one request with the output, which looks like this.
{"Severity": [ {"Emergency":0}, {"Alert":0}, {"Critical":0}, {"Error":0}, {"Warning":0}, {"Notice":0}, {"Info":2711}, {"Debug":410} ], "Facility": [ {"Kernel Messages":0}, {"User-Level Messages":0}, {"Mail System":0}, {"System Daemons":0}, {"Security/Authorization Messages":0}, {"Internal Syslogd Messages":0}, {"Line Printer Subsystem":2711}, {"Network News Subsystem":410}, .... {"Local Use 0 (local0)": 2574}, ... ]}
Thus, the “key” in the “Severity / Object” array is the Data part of the above json data, and the “value” in the Severity / Facility array is a Count document for each Code type.
Example:
Using the above data as a guide,
There are 2711 documents with Info severity in my database.
There are 410 documents with Debug severity in my database.
There are 2574 documents in my database with the setting local0 .
etc.
What I would like to do is generate the appropriate indexes when the application starts (or check if they already exist), but I don’t even know where to start.
Note: the application must generate an index, this is not enough to simply manually write it to the RavenDB web interface.