lobid/lodmill — pull request #283 by fsteeg (2013-12-16 12:29:31+00:00)
Title: Narrow down `/resource` queries to holding organisation

With this pull request, `/resource` queries can be narrowed down to results that are held by a given organisation using the `owner` query parameter. The owner can be a simple ISIL (e.g. `DE-6`) or the full lobid ID (e.g. `http://lobid.org/organisation/DE-6`). The corresponding issue is #246.

Deployed to staging for testing. Sample queries:

http://staging.api.lobid.org/resource?set=NWBib&owner=DE-6
http://staging.api.lobid.org/resource?author=118580604&owner=DE-6
http://staging.api.lobid.org/resource?id=0940450003&owner=DE-6-020

While these queries do seem to work, this functionality touches the limits of our current hardware: the parent-child relations in Elasticsearch need a lot of RAM (they are used here to implement the relation between resources and their items, the latter of which contain the holdings information).

After a restart of Elasticsearch, the first `owner` query takes really long. Subsequent queries seem to work fine, but Elasticsearch keeps a high CPU load, and uses a lot of virtual memory (peaks at 300% CPU, 21g virtual memory). Therefore, I'm not sure we should actually deploy this to production with our current hardware setup.