{"push_id":953257153,"size":1,"distinct_size":1,"ref":"refs/heads/dev/elasticsearch-global-client","head":"7037e6ba1c371ddc688a63df999b1b1e0e41a12e","before":"1aee667e365ba657b50261b2b57df19f34b422c0","commits":[{"sha":"7037e6ba1c371ddc688a63df999b1b1e0e41a12e","author":{"email":"8d5004c9c74259ab775f63f7131da077814a7636@sevein.com","name":"Jesús García Crespo"},"message":"elasticSearchFunctions: global client as module attribute\n\nElasticsearch's client is thread-safe. We use it in two different contents:\nour `dashboard` application and `clientScripts`.\n\nThis commit stores the Elasticserach instance as an attribute of its module.\nAccess to the instance if provided via `get_client()`, but it requires previous\ninitialization. In the `dashboard this is achieved in `apache/django.wsgi` while\nclientScripts have to initialize it manually for now. An exception is raised if\nthe user tries to access to the client before initialization.\n\nUsage example:\n\n    import elasticSearchFunctions\n    elasticSearchFunctions.setup(hosts=['127.0.0.1:9200'])\n    client = elasticSearchFunctions.get_client()\n    results = client.search(**{})\n\nIt's been provided an extra setup method that reads the configuration param\nfrom `clientConf.conf` to ease the transaction. This will be used by both\n`dashboard` and `clientScripts` until they enable other ways to provide that\nconfiguration, which is work in progress.\n\nIn addition, the dashboard receives a new middleware that replaces the old\n`elasticsearch_required`. See `middleware.common.ElasticsearchMiddleware`. It\nredirects the user to a custom Elasticsearch error page when one of the two\nfollowing exceptions have been raised in the view: `ElasticsearchException` and\n`ImproperlyConfigured`. The main advantage here is to avoid an extra hit to the\nElasticsearch server (as the previous `check_server_status` function used to\ndo).","distinct":true,"url":"https://api.github.com/repos/artefactual/archivematica/commits/7037e6ba1c371ddc688a63df999b1b1e0e41a12e"}]}