{ "info": { "author": "Radu Gheorghe", "author_email": "radu0gheorghe@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "======\r\nSlimES\r\n======\r\n\r\nThin Python client for Elasticsearch\r\n====================================\r\n\r\nThis is a little wrapper over the `requests `_ module that helps you do your thing with Elasticsearch. But not too much. For each request, you need to specify the following, where they are applicable:\r\n\r\n* desired request method\r\n\r\n* index, type, ID\r\n\r\n* \"suffix\" (which might be the _search, _bulk, etc at the end of the URL)\r\n\r\n* a dictionary or a string with the data you want to submit\r\n\r\n\r\nWhy would I want that?\r\n======================\r\n\r\nTwo reasons:\r\n\r\n* flexibility - the point of this client is to keep up with the many features constantly added to Elasticsearch. You can customize your index operations and queries as much as you need\r\n\r\n* documentation - once you get the hang of the few options particular to this client, you only have to look at the documentation on Elasticsearch itself to access its features\r\n\r\nIf this is not what you want, I would suggest to look at `pyes `_ or `pyelasticsearch `_\r\n\r\nFeatures and usage\r\n==================\r\n\r\nThere are a few files in there at the moment:\r\n\r\n* slimes.py - the module itself\r\n\r\n* tests_slimes.py - unit tests\r\n\r\nHere are the main features:\r\n\r\nConverts your dict to JSON (you can disable that for stuff like bulks)\r\n----------------------------------------------------------------------\r\n\r\n::\r\n\r\n #!/usr/bin/env python\r\n import slimes\r\n my_requester = slimes.Requester([\"localhost:9200\"])\r\n #define the document\r\n testdoc = {\"foo\": 2345, \"bar\": True}\r\n #post the document\r\n my_requester.request(method=\"post\",\r\n myindex=\"testindex\",\r\n mytype=\"testtype\",\r\n mydata=testdoc)\r\n\r\nCan get a list of nodes, for redundancy\r\n---------------------------------------\r\n\r\n::\r\n\r\n #!/usr/bin/env python\r\n import slimes\r\n my_requester = slimes.Requester([\"localhost:9200\",\"my_other_server:9200\"])\r\n\r\nLoads the JSON results for you\r\n------------------------------\r\n\r\nIf something goes wrong (eg: non 2XX status code), you'll get an exception. Otherwise, you'll get a dictionary with the results from ES::\r\n\r\n #!/usr/bin/env python\r\n import slimes\r\n my_requester = slimes.Requester([\"localhost:9200\"])\r\n myquery = {\\\r\n \t\"query\": {\\\r\n \t\t\"term\": {\\\r\n \t\t\t\"age\": 28\\\r\n \t\t}\\\r\n \t}\\\r\n }\r\n results = my_requester.request(method=\"post\",\r\n \tmyindex=\"testindex\",\r\n \tmytype=\"testtype\",\r\n \tmysuffix=\"_search\",\r\n \tmydata=myquery)\r\n print \"Number of hits is %d\" % result['hits']['total']\r\n\r\nCan receive parameters at will\r\n----------------------------------\r\n\r\nSo you can index with the \"create\" parameter, like this::\r\n\r\n #!/usr/bin/env python\r\n import slimes\r\n my_requester = slimes.Requester([\"localhost:9200\"])\r\n testdoc={\"foo\": \"bar\"}\r\n my_requester.request(method=\"put\",\r\n \tmyindex=\"testindex\",\r\n \tmytype=\"testtype\",\r\n \tmyID=1,\r\n \tmysuffix=\"?op_type=create\",\r\n \tmydata=testdoc)\r\n\r\nOr, you can put the parameter(s) as a dictionary::\r\n\r\n #!/usr/bin/env python\r\n import slimes\r\n my_requester = slimes.Requester([\"localhost:9200\"])\r\n testdoc={\"foo\": \"bar\"}\r\n my_requester.request(method=\"put\",\r\n myindex=\"testindex\",\r\n mytype=\"testtype\",\r\n myID=1,\r\n myparams={\"op_type\":\"create\"},\r\n mydata=testdoc)\r\n\r\nAnd you can also specify a timeout::\r\n\r\n #!/usr/bin/env python\r\n import slimes\r\n my_requester = slimes.Requester([\"localhost:9200\"])\r\n #give it 10 seconds to complete, otherwise give Exception\r\n my_requester.request(mytimeout=10)\r\n\r\nTODOes\r\n======\r\n\r\nEnhancements will be about the transport. Stuff like:\r\n- use thrift\r\n- get all cluster nodes\r\n\r\nStay tuned :)\r\n\r\nBugs\r\n====\r\n\r\nPlease feel free to report them on `github `_", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/SlimES/", "keywords": "Elasticsearch", "license": "LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "SlimES", "package_url": "https://pypi.org/project/SlimES/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/SlimES/", "project_urls": { "Homepage": "http://pypi.python.org/pypi/SlimES/" }, "release_url": "https://pypi.org/project/SlimES/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "Thin Python connector for Elasticsearch.", "version": "0.0.2" }, "last_serial": 785678, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "924403b53916c791f993f6fd21c169f1", "sha256": "9a27ba9d7c2ed67e784e607f5e3556bec8c4d4a937c92e56209b7f50c6f59f72" }, "downloads": -1, "filename": "SlimES-0.0.1.tar.gz", "has_sig": false, "md5_digest": "924403b53916c791f993f6fd21c169f1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4123, "upload_time": "2012-08-24T06:51:41", "url": "https://files.pythonhosted.org/packages/08/91/09eaa5b3b1a5a5c812885960af8edbd35924e19df579323aeac42c65fcb3/SlimES-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "72ccbe2764ded84d2f5b48d48e45580e", "sha256": "e9337c3f254f207ce4cd997042904df6e349eed322853cb3f4bdd294dd580f73" }, "downloads": -1, "filename": "SlimES-0.0.2.tar.gz", "has_sig": false, "md5_digest": "72ccbe2764ded84d2f5b48d48e45580e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4196, "upload_time": "2012-09-10T12:52:49", "url": "https://files.pythonhosted.org/packages/b3/16/10bed4b06809b3bd8ffb39ffb2c2acff4d1ae10d553dd47143cc4faa1cb4/SlimES-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "72ccbe2764ded84d2f5b48d48e45580e", "sha256": "e9337c3f254f207ce4cd997042904df6e349eed322853cb3f4bdd294dd580f73" }, "downloads": -1, "filename": "SlimES-0.0.2.tar.gz", "has_sig": false, "md5_digest": "72ccbe2764ded84d2f5b48d48e45580e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4196, "upload_time": "2012-09-10T12:52:49", "url": "https://files.pythonhosted.org/packages/b3/16/10bed4b06809b3bd8ffb39ffb2c2acff4d1ae10d553dd47143cc4faa1cb4/SlimES-0.0.2.tar.gz" } ] }