{ "info": { "author": "koebane82", "author_email": "jeff@koebane.net", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# ElasticSearchPy\n\n## About\nElasticSeachPy is a python library used to connect to and interact with elasticsearch\n\nThis library is a python implementation of the Elasticsearch HTTP [API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html) and an alternative to ElasticSearch's Python [Library](https://elasticsearch-py.readthedocs.io/en/master/api.html)\n\n## Installation\nElasticSearchPy can be install with the pip distribution system for Python by issuing:\n```\n$ pip3 install elasticsearch-python-client\n```\nAlternatively, you can run use setup.py to install by cloning this repository and issuing:\n```\n$ python3 setup.py install\n```\n\n## Limitations\nThis library is currently under development and is not as feature rich as it will be. This being said, it currently has several limitations\n* **Python3+ Only** - My primary development environment is python3, I currently do not have the time to test and vet interoperability between python2 and python3\n* **ElasticSearch Authentication** - Currently, this library only supports \"No Authentication\" and \"SSL w/ Certificate Authentication\". This limitation is simply due to my testing environments\n* **Limited Functionality** - If functionality isn't listed here, it is either not implemented or is not tested. As time moves forward, I will continue to add fuctionality\n\n## Contributors\nIf you are interested in contributing to this project, feel free to contact me at jeff@koebane.net\n\n## Examples\n### Connecting to ElasticSearch\n```python\nfrom elasticsearchpy import ElasticSearchConnection\nes_ip = \"192.168.1.1\"\n# Connect to the cluster\nes_conn = ElasticSearchConnection(es_ip)\n# Connect to the cluster with a non 9200 port\n# es_conn = ElasticSearchConnection(es_ip, port=80)\n# Alternatively Connect to the cluster using SSL certificates\n# es_conn = ElasticSearchConnection(es_ip, port=443,\n# use_ssl=True,\n# cert=\"/path/to/cert.crt\",\n# key=\"/path/to/key.key\"\n#)\n```\n\n### Interact with the Cluster\n```python\nfrom elasticsearchpy import ElasticSearchConnection\nes_ip = \"192.168.1.1\"\n# Connect to the cluster\nes_conn = ElasticSearchConnection(es_ip)\n\n#Get Cluster Object\nes_cluster = es_conn.get_cluster()\n# get number of active shards\nprint(\"There are {} active shards\".format(es_cluster.active_shards))\n# Get the number of hosts\ntotal_nodes = es_cluster.nodes\ndata_nodes = es_cluster.data_nodes\n\nprint(\"This cluster has {} nodes ( {} data nodes )\".format(total_nodes,data_nodes))\n\n# Get Node Names\nnodes = es_cluster.node_names\nprint(\"This cluster has the following nodes:\")\nfor node_name in nodes:\n print(\"- {}\".format(node_name))\n```\n\n### Interact with a cluster node\n```python\nfrom elasticsearchpy import ElasticSearchConnection\n\nes_ip = \"192.168.1.1\"\n\n# Connect to the cluster\nes_conn = ElasticSearchConnection(es_ip)\n\n#Get Cluster Object\nes_cluster = es_conn.get_cluster()\n\n# Get Node Names\nnodes = es_cluster.node_names\n\n# Get Node Object\nnode = es_cluster.get_node(nodes[0)\n\nprint(\"Node {}\".format(node.name)\nif node.master:\n print(\"* Is the master Node\")\nif node.ingest_node:\n print(\"* Is an ingest Node\")\nif node.data_node:\n print(\"* Is a data node\")\n\nprint(\"Elasticsearch Version: {}\".format(node.version))\nprint(\"OS: {}\".format(node.os))\nprint(\"Has the following roles\")\nprint(\"------------------------\")\nfor role in node.roles:\n print(\" - {}\".format(role))\n```\n\n### Interact with indices\n```python\nfrom elasticsearchpy import ElasticSearchConnection\n\nes_ip = \"192.168.1.1\"\n\n# Connect to the cluster\nes_conn = ElasticSearchConnection(es_ip)\n\n# Get Indices Object\nnon_sys_indices = es_conn.get_indices() # this gets all non-system indices\nall_indices = es_conn.get_indices(system_indices=True) # this gets all indices including system indices\nbob_indices = es_conn.get_indices(indice_prefix=\"bob\") # this gets all indices that start with bob\n\n# List indices\nprint(\"Here are the non-system indices\")\nfor indice in non_sys_indices.indices:\n print(\"- {}\".format(indice)\nprint(\"Total: {}\".format(non_sys_indices.count)\n\n# Create an indice\nmy_indice = indices.create_indice(\"bob-1\") # Creates bob-1 with default shard replica values\nmy_indice2 = indices.create_indice(\"bob-2\", shards=2, replicas=0) # Creates bob-2 with 2 shards and 0 replicas\n\n# Delete an indice\nindices.delete_indice(\"bob-2\") # Deletes the Indice named bob-2\n```\n### Interact with a single indice\n```python\nfrom elasticsearchpy import ElasticSearchConnection\nfrom elasticsearchpy import ElasticSearchIndice\n\nes_ip = \"192.168.1.1\"\n\n# Connect to the cluster\nes_conn = ElasticSearchConnection(es_ip)\n\n# Get Indices Object\nnon_sys_indices = es_conn.get_indices() # this gets all non-system indices\n\n# Get the Indice Object\nmy_indice = non_sys_indice.get_indice(\"bob-1\") # Retrieves an indice object from the indice bob-1\n\n# Alternative way of getting the Indice Object\nmy_indice_2 = ElasticSearchIndice(\"bob-2\",es_conn)\n\nprint(\"Indice {} has the following properties\".format(my_indice.name))\nprint(\"- Status: {}\".format(my_indice.status))\nprint(\"- Health: {}\".format(my_indice.health))\nprint(\"- Number of documents: {}\".format(my_indice.docs))\nprint(\"- Size: {}\".format(my_indice.size))\n\ndoc_data = {\n \"message\":\"I am a test message\",\n \"user\":\"test user\",\n \"purpose\":\"TESTING...DUUU\"\n}\n# Creating Documents\ndoc = my_indice.create_doc(doc_data) # this creates a do and lets elasticsearch generate the id\ndoc = my_indice.create_doc(doc_data,name=\"document-1234\") # this creates a document that you generate the id for\n\n# Deleting Documents\nmy_indice.delete_doc(\"document-1234\")\n```\n\n## Immediate future TODO List\n* Add document search to indice object\n* Add templates\n* Document documents object\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/koebane82/elasticsearchpy", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "elasticsearch-python-client", "package_url": "https://pypi.org/project/elasticsearch-python-client/", "platform": "", "project_url": "https://pypi.org/project/elasticsearch-python-client/", "project_urls": { "Homepage": "https://github.com/koebane82/elasticsearchpy" }, "release_url": "https://pypi.org/project/elasticsearch-python-client/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "An Alternative ElasticSearch Python Library", "version": "0.0.1" }, "last_serial": 4463001, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2a64d3e21fe2bde085aed70abbf3a756", "sha256": "e11e265fa45c652c97645c715ccae3d87f1520f1869cb34817144df214adbd38" }, "downloads": -1, "filename": "elasticsearch_python_client-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2a64d3e21fe2bde085aed70abbf3a756", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 30684, "upload_time": "2018-11-07T20:58:31", "url": "https://files.pythonhosted.org/packages/08/4a/12eecf27c5cd51dfcc4b5de19310219d504bc7d38e1e5b499c5401892753/elasticsearch_python_client-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "739b591b0aa59bf1641126a2ad2f9128", "sha256": "d8ee3bed7e305f5f4bde8dc5d306f8b10a3e8a7762ff70d4f660e8da524c98f0" }, "downloads": -1, "filename": "elasticsearch-python-client-0.0.1.tar.gz", "has_sig": false, "md5_digest": "739b591b0aa59bf1641126a2ad2f9128", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16022, "upload_time": "2018-11-07T20:58:32", "url": "https://files.pythonhosted.org/packages/3a/b9/046ba7578b2a5600d417b024d1b5405fe28ab1309ca5efa17d099e6496dd/elasticsearch-python-client-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2a64d3e21fe2bde085aed70abbf3a756", "sha256": "e11e265fa45c652c97645c715ccae3d87f1520f1869cb34817144df214adbd38" }, "downloads": -1, "filename": "elasticsearch_python_client-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2a64d3e21fe2bde085aed70abbf3a756", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 30684, "upload_time": "2018-11-07T20:58:31", "url": "https://files.pythonhosted.org/packages/08/4a/12eecf27c5cd51dfcc4b5de19310219d504bc7d38e1e5b499c5401892753/elasticsearch_python_client-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "739b591b0aa59bf1641126a2ad2f9128", "sha256": "d8ee3bed7e305f5f4bde8dc5d306f8b10a3e8a7762ff70d4f660e8da524c98f0" }, "downloads": -1, "filename": "elasticsearch-python-client-0.0.1.tar.gz", "has_sig": false, "md5_digest": "739b591b0aa59bf1641126a2ad2f9128", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16022, "upload_time": "2018-11-07T20:58:32", "url": "https://files.pythonhosted.org/packages/3a/b9/046ba7578b2a5600d417b024d1b5405fe28ab1309ca5efa17d099e6496dd/elasticsearch-python-client-0.0.1.tar.gz" } ] }