{ "info": { "author": "St\u00e9phane JAIS", "author_email": "stephane@cantinasoftware.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Utilities" ], "description": "rubber\n======\n\nrubber is a Python client for Elasticsearch.\n\nIts main features are:\n - rubber is easy to use\n - rubber does not try to hide or wrap Elasticsearch syntax.\n - rubber integrates nicely with Django:\n - automatically saves your models to Elasticsearch\n - provides a Manager-style object on your django models\n for querying\n - rubber is unit-testing friendly: you don't need an\n elasticsearch instance to run your tests\n\nDependencies\n============\n\nrubber needs the 'requests' Python package.\n\nInstallation\n============\n\n pip install rubber\n\nUsage\n=====\n\nBasic usage\n----------\n\n### Creating an ElasticSearch client\n\nThe main class is rubber.ElasticSearch.\nYou instanciate a rubber.ElasticSearch object for an index_name and a document type, like this:\n\n import rubber\n\n client = rubber.ElasticSearch('articles', 'article')\n\n # -OR-\n\n client = rubber.ElasticSearch('articles')\n\n### The client interface\n\nOnce you have such an object, you can GET/PUT/POST/DELETE on the __search_, _count_ and __mapping_ endpoints.\nThese endpoints are available on the _search_, _count_ and _mapping_ properties of the client:\n\n client.search\n client.mapping\n client.count\n\nYou can GET/PUT/POST/DELETE on each endpoint like this:\n\n response = client.mapping.get()\n response = client.mapping.put(somedict)\n response = client.mapping.delete()\n\nAll four methods (get/put/post/delete) are directly mapped on [their equivalent _requests_ method](http://docs.python-requests.org/en/latest/api/#requests.Request),\nthis means that you can pass any additional parameter that the requests library accepts (files, headers, cookies, etc.).\n\n response = client.search.get(params={\"q\":\"*\"})\n\nEach endpoint is callable and defaults to get(). That means that you can search like this:\n\n response = client.search() # Equivalent to client.search.get()\n\n### Response objects\n\nResponses are just like request.models.Response objects returned by the _requests_ library we use under the hood.\nYou can get the corresponding JSON like this:\n\n somedict = response.json\n\nMore information is also avalable (see the [requests documentation](http://docs.python-requests.org/en/latest/api/#requests.Response)):\n\n headers = response.headers\n status = response.status_code\n\nIf you were searching, you can additionnaly look that _response.results_,\nto get a HitCollection, which is an iterable over Hit objects.\n\n results = response.results\n for hit in results:\n print \"%s: %s\" % (hit.source.title, hit.score)\n\n### Hit objects\n\nHit objects are plain Python objects, they give you object notation over the resulting JSON.\nAs a convenience, they also allow you to get '_' properties without the uderscore, like this:\n\n hit.source # => the '_source' property of the JSON hit\n hit._source # => the exact same thing\n hit.score # => the '_score'\n\n### Advanced configuration\n\n#### HTTP configuration\n\nSince rubber is based on the [requests library](http://python-requests.org), \nyou can configure every aspect of the HTTP request/response cycle directly\nthrough [_requests_ configuration options](http://docs.python-requests.org/en/latest/user/advanced/#configuring-requests).\n\n#### Error behavior\n\nBy default, any error calling elasticsearch will yield a None response and log the exception.\nThis can be changed when instanciating a rubber.ElasticSearch:\n\n es = rubber.ElasticSearch(raise_on_error=True)\n\n### Unit testing\n\nYou probably want to be able to run unit tests without having Elasticsearch running.\nIf that is the case, rubber has a configuration option that allows you to mock\ncontent returned by elasticsearch.\n\nJust set rubber.settings.RUBBER_MOCK_HTTP_RESPONSE to a string that should be the response body\nand you're set.\n\nDjango integration\n------------------\n\n### Integrating rubber into your models\n\nRubber lets you add an 'elasticsearch' property on your models, like this:\n\n import rubber\n from django.db import models\n\n class Article(models.Model):\n # Elasticsearch\n elasticsearch = rubber.ElasticSearch()\n\n title = models.CharField(max_length=255)\n content = models.TextField()\n\n### Saving your models to Elasticsearch\n\nBy default, adding a rubber.ElasticSearch instance to your model\nwill automatically save it to Elasticsearch.\n\nThis can be turned off:\n\n class Article(models.Model):\n # Elasticsearch\n elasticsearch = rubber.ElasticSearch(auto_index=False)\n\n### Controlling the index name and document type\n\nBy default rubber will store all the models of the same Django app in the same index,\nwith a different document type for each model.\n\nThe index name is the name of the app. The document type is the name of the model ('article' in our example)\n\nThis can be changed like this:\n\n class Article(models.Model):\n # Elasticsearch\n elasticsearch = rubber.ElasticSearch(index_name='someindex', type='somedocumenttype')\n\n### Storing a model in multiple indices\n\nYou can add as many rubber.ElasticSearch properties to your model, each one saving to a different index / document type,\nlike this:\n\n class Article(models.Model):\n index1 = rubber.ElasticSearch(index_name='index1', type='type1')\n index2 = rubber.ElasticSearch(index_name='index2', type='type2')\n\n### Searching your models\n\nYou can use the 'elasticsearch' instance on your model class like this:\n\n # Searching\n response = Article.elasticsearch.search(query) # query is a dict\n\n # Mapping\n response = Article.elasticsearch.mapping.put(mapping) # mapping is a dict\n\n### Manually indexing your models\n\nThe 'elasticsearch' property will be propagated to your model instances, bound to the specific instance\nyou are working with:\n\n article = Article.objects.get(pk=1)\n\n response = article.elasticsearch.put() # Index this document\n response = article.elasticsearch.delete() # Delete this document\n\nOther clients\n=============\n\nCheck out [other elasticsearch clients](http://www.elasticsearch.org/guide/appendix/clients.html)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cantinasoftware/rubber", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "rubber", "package_url": "https://pypi.org/project/rubber/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rubber/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/cantinasoftware/rubber" }, "release_url": "https://pypi.org/project/rubber/0.1.8/", "requires_dist": null, "requires_python": null, "summary": "Elasticsearch client with Django support.", "version": "0.1.8" }, "last_serial": 799129, "releases": { "0.1": [ { "comment_text": "built for Darwin-12.0.0", "digests": { "md5": "106c6c80409038c1222c23ec2c9deb4d", "sha256": "398eaf5ee88aaa66bba952f3583d24439af9b4eb58a9b8b7868377772e5fdaa3" }, "downloads": -1, "filename": "rubber-0.1.macosx-10.8-intel.tar.gz", "has_sig": false, "md5_digest": "106c6c80409038c1222c23ec2c9deb4d", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 12387, "upload_time": "2012-08-02T17:59:32", "url": "https://files.pythonhosted.org/packages/ec/22/ffafb490f91be0e30fee4064f63649692fbc17b2130fe58a2c4e3c93645e/rubber-0.1.macosx-10.8-intel.tar.gz" }, { "comment_text": "", "digests": { "md5": "1e7b99d5d86fc50f1327ea49b7ce0da1", "sha256": "67f61dd088968944a8c3b304f3b1ca6606521e5d4c7eb69c0501976bdee677ae" }, "downloads": -1, "filename": "rubber-0.1.tar.gz", "has_sig": false, "md5_digest": "1e7b99d5d86fc50f1327ea49b7ce0da1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5392, "upload_time": "2012-08-02T17:54:59", "url": "https://files.pythonhosted.org/packages/b0/b6/9c4a98bb5c92fa655d4e395ceaa7bc29ec01109525d99603c3068157d912/rubber-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ab9f13e7d5b598a90f3dc0cf33388add", "sha256": "0c3daea1272cffbb1f8652f698640756e6b0b674592ce6172ff24057973de0b8" }, "downloads": -1, "filename": "rubber-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ab9f13e7d5b598a90f3dc0cf33388add", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5469, "upload_time": "2012-08-02T18:00:13", "url": "https://files.pythonhosted.org/packages/d6/bb/52cac1bda720461aaa8c0bfa2a4e9dbba1df6efca8af4bfc5ea64911b632/rubber-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "0a1fe806a9336a910a0e3eed8881084a", "sha256": "a8e94d7c1325c7bfd303b8272fd5393bbe1c331cb38f410a9e88f2dd96b230b8" }, "downloads": -1, "filename": "rubber-0.1.2.tar.gz", "has_sig": false, "md5_digest": "0a1fe806a9336a910a0e3eed8881084a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6263, "upload_time": "2012-08-02T18:34:47", "url": "https://files.pythonhosted.org/packages/c5/8b/e8446643a746e7e734d900f5bfbd5933690b90b2ade396552de1ff2ce51a/rubber-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "ea29ae1fe9005889b44577b312f3d7e0", "sha256": "37a7f4b5aab9a7db743a92da5f6c99adbe54530e47d8101cfe5c1dc9c1c70798" }, "downloads": -1, "filename": "rubber-0.1.3.tar.gz", "has_sig": false, "md5_digest": "ea29ae1fe9005889b44577b312f3d7e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7846, "upload_time": "2012-08-03T12:14:50", "url": "https://files.pythonhosted.org/packages/03/8e/532c04dfac61eb61c69ec002e32569f80cf8dc3c0e66ad78c21fc0f18f04/rubber-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "2b5fbaca24cee7d37bf65d35c11f5c43", "sha256": "56da01eca5a522bd107483fada4647a9a22a17fc400a95739d0436821c744e02" }, "downloads": -1, "filename": "rubber-0.1.4.tar.gz", "has_sig": false, "md5_digest": "2b5fbaca24cee7d37bf65d35c11f5c43", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7937, "upload_time": "2012-08-03T13:32:59", "url": "https://files.pythonhosted.org/packages/1c/e4/aac8006b94dd6b113e1b7fbb55a72fa28057125eaa59f0716ede7c6695f7/rubber-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "c3a4141c03a70f742a0742a06b0253c4", "sha256": "2f5be9fb98bb3b3d5d28d99013db93671050748614a3fba66379d5c2e974ea5b" }, "downloads": -1, "filename": "rubber-0.1.5.tar.gz", "has_sig": false, "md5_digest": "c3a4141c03a70f742a0742a06b0253c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7959, "upload_time": "2012-08-03T18:48:53", "url": "https://files.pythonhosted.org/packages/eb/f4/fda119f054c5aa28f242e1ed727c0b5fce6cd59cc9d23865ab79bf284b0d/rubber-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "3836108e7f361dc9ea39674260aa9c97", "sha256": "6467025cebd72415d827b8020e0209a06a398272667f63d7d70db795212fa4b2" }, "downloads": -1, "filename": "rubber-0.1.6.tar.gz", "has_sig": false, "md5_digest": "3836108e7f361dc9ea39674260aa9c97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8144, "upload_time": "2012-08-04T10:11:18", "url": "https://files.pythonhosted.org/packages/a4/8f/9d0939080b498cb492994de601250f794bf16f3e20c349a6c41e9596b814/rubber-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "8eb8743018f5b686a3d39e8303f64214", "sha256": "4cf8e5603b9bb6bfcd4f7cccaf92bb57d84a66da3feeb85d29f8d0073e4bd860" }, "downloads": -1, "filename": "rubber-0.1.7.tar.gz", "has_sig": false, "md5_digest": "8eb8743018f5b686a3d39e8303f64214", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8936, "upload_time": "2012-08-06T09:49:57", "url": "https://files.pythonhosted.org/packages/9f/e6/9e10164b02d322ab4820df7834aaed119f3cfbe2105ef7a48b3edfdcff77/rubber-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "8f7629fc5362bb2fc59a6ff3e8b975aa", "sha256": "685775af2e6a55829d2eaf9e5fb61e171b37e9718c3388206d95af113447962e" }, "downloads": -1, "filename": "rubber-0.1.8.tar.gz", "has_sig": false, "md5_digest": "8f7629fc5362bb2fc59a6ff3e8b975aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9850, "upload_time": "2012-08-06T13:43:42", "url": "https://files.pythonhosted.org/packages/18/aa/2bcefc631604331b6543525735d4cc532a47714f96ae52f436b94458593a/rubber-0.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8f7629fc5362bb2fc59a6ff3e8b975aa", "sha256": "685775af2e6a55829d2eaf9e5fb61e171b37e9718c3388206d95af113447962e" }, "downloads": -1, "filename": "rubber-0.1.8.tar.gz", "has_sig": false, "md5_digest": "8f7629fc5362bb2fc59a6ff3e8b975aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9850, "upload_time": "2012-08-06T13:43:42", "url": "https://files.pythonhosted.org/packages/18/aa/2bcefc631604331b6543525735d4cc532a47714f96ae52f436b94458593a/rubber-0.1.8.tar.gz" } ] }