{"id":30337448,"url":"https://github.com/cr0wg4n/kibana-api","last_synced_at":"2025-08-18T06:05:00.211Z","repository":{"id":50836299,"uuid":"369680236","full_name":"cr0wg4n/kibana-api","owner":"cr0wg4n","description":"This is an API mapping library to interact with objects of kibana API","archived":false,"fork":false,"pushed_at":"2023-01-15T22:31:41.000Z","size":57,"stargazers_count":12,"open_issues_count":3,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-16T22:26:17.442Z","etag":null,"topics":["kibana","kibana-api","library","visualization"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/kibana-api/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cr0wg4n.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-22T00:09:17.000Z","updated_at":"2025-05-12T14:49:05.000Z","dependencies_parsed_at":"2023-02-09T23:50:14.041Z","dependency_job_id":null,"html_url":"https://github.com/cr0wg4n/kibana-api","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cr0wg4n/kibana-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr0wg4n%2Fkibana-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr0wg4n%2Fkibana-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr0wg4n%2Fkibana-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr0wg4n%2Fkibana-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cr0wg4n","download_url":"https://codeload.github.com/cr0wg4n/kibana-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr0wg4n%2Fkibana-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270800137,"owners_count":24648133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kibana","kibana-api","library","visualization"],"created_at":"2025-08-18T06:01:44.692Z","updated_at":"2025-08-18T06:05:00.188Z","avatar_url":"https://github.com/cr0wg4n.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kibana API Mapping Library\n\n\u003e Note: This is an unofficial library (a proof of concept only)\n\n[![Supported Versions](https://img.shields.io/pypi/pyversions/kibana-api.svg)](https://pypi.org/project/kibana-api/)\n[![Downloads](https://pepy.tech/badge/kibana-api/month)](https://pepy.tech/project/kibana-api/month)\n\n\n## Development Requirements\nI only use `requests` to perform HTTP requests and pure logic for \nall behaviour.\n## Installation\nYou can find this package in https://pypi.org/project/kibana-api/\n\n```bash\npip install kibana-api\n```\n## Usage and Examples\nIf you going to test every example, you should run the `docker-compose.yml` example(development section).\n\nTake a note: every `create` action returns a `\u003cRequests\u003e` Object as a result of HTTP request\n\n### Configure Kibana Object:\n```python\nURL = \"http://localhost:5601\"\nUSERNAME = \"XXXX\" \nPASSWORD = \"XXXX\"\n# username and password are optional fields\nkibana = Kibana(base_url=URL, username=USERNAME, password=PASSWORD)\n```\n\n### Create Space\n```python\nid = \"demo\"\nname = \"demo\"\ndescription = \"descripcion del espacio de pruebas\"\ncolor = \"#000000\"\nspace = kibana.space(id=id, name=name, description=description, color=color)\nspace_response = space.create()\nspace_json = space_response.json()\n```\n\n### Create Object (index-pattern)\n```python\npattern_json = {\n    \"title\":\"demo*\",\n    \"timeFieldName\": \"@timestamp\", #timefiledname is important, it taken as a reference to time\n    \"fields\":\"[]\"\n}\nkibana = Kibana(base_url=URL, username=USERNAME, password=PASSWORD)\nindex_pattern_response = kibana.object(space_id=\"demo\").create('index-pattern', attribs=pattern_json)\nindex_pattern_json = index_pattern.json()\n```\n\n### Create Object (visualization)\n```python\ntype = \"metric\"\ntitle = \"Hello this is a basic metric visualization\"\nindex_pattern_id = \"XXXX-XXX-XXXX\" # every visualization needs an index pattern to work\nvisualization = Visualization(type=type, title=title, index_pattern_id=index_pattern).create()\nvisualization_response = kibana.object(space_id=\"demo\").create('visualization', body=visualization)\nvisualization_json = visualization_response.json()\n```\n\n### Visualization Modelation\n```python\nindex_pattern = \"XXXXX-XXXXXX-XXXXXX\"\ntype = \"line\"\ntitle = \"Hello this is a basic line visualization\"\nvisualization = Visualization(type=type, title=title, index_pattern_id=index_pattern)\nvisulization_model_json = visualization.create() # this operation returns a JSON body not a request response\n```\n\n### Panel Modelation\n```python\nwidth=48 \nheight=12\npos_x=0\npos_y=1\npanel = Panel(\"panel_0\", width, height, pos_x, pos_y, visualization_id=visualization_id)\npanel_model_json = panel.create() # this operation returns a JSON body not a request response\nreferences_model_json = panel.get_references() # this operation returns a JSON body not a request response\n```\n\n### Create Object (dashboard)\n```python\nindex_pattern_id = \"XXXXX-XXXXXX-XXXXXX\"\ntype = \"line\"\ntitle = \"Hello this is a basic line visualization\"\nvisualization = Visualization(type=type, title=title, index_pattern_id=index_pattern_id).create() # this operation returns a JSON body not a request response\nvisualization_response = kibana.object(space_id=\"demo\").create('visualization', body=visualization)\nvisualization_json = visualization_response.json()\nvisualization_id = visualization_json[\"id\"]\n\npanel = Panel(\"panel_0\", 48, 12, 0, 2, visualization_id=visualization_id)\npanels = [panel.create()]\nreferences = [panel.get_reference()]\ndashboard = Dashboard(title=\"Demo Dashboard\", panels=panels, references=references).create() # this operation returns a JSON body not a request response\n\ndashboard_response = kibana.object(space_id=mock.space_id).create('dashboard', body=dashboard)\ndashboard_json = dashboard_response.json()\n```\n\n### List all objects\n```python\nobjects_response = kibana.object(space_id=\"demo\").all() # All objects\nobjects_json = objects_response.json()\n# Filter by types: \"visualization\", \"dashboard\", \"search\", \"index-pattern\", \n# \"config\", \"timelion-sheet\", \"url\", \"query\", \"canvas-element\", \"canvas-workpad\", \"lens\",\n# \"infrastructure-ui-source\", \"metrics-explorer-view\", \"inventory-view\"\nobjects_response = kibana.object(space_id=\"demo\").all(type=\"index-pattern\") # Type in specific \n# objects_response will be a generator with the request response\nfor response in objects_response:\n  response.json()\n```\n\n### List all spaces\n```python\nspaces_response = kibana.space().all() # All spaces\nspaces_json = spaces_response.json()\n```\n\n### Import Objects\n```python\nfile = open(\"demo.ndjson\", 'r')\nresponse = kibana.object().loads(file=file)\nfile.close()\n```\n\n## Development\n\nBefore starting you should run the `docker-compose.yml` file at `tests` folder (for \ntesting purposes):\n\n```yaml\nversion: '2.2'\n\nservices:\n  elastic:\n    hostname: elasticsearch\n    image: docker.elastic.co/elasticsearch/elasticsearch:${VERSION}\n    container_name: elastic\n    environment:\n      - \"ES_JAVA_OPTS=-Xms512m -Xmx512m\"\n      - discovery.type=single-node\n      - xpack.security.enabled=true\n      - xpack.security.audit.enabled=true\n      - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}\n    ulimits:\n      memlock:\n        soft: -1\n        hard: -1\n    volumes:\n      - elastic_volume:/usr/share/elasticsearch/data\n    ports:\n      - 9200:9200\n    networks:\n      - elastic\n\n  kibana:\n    image: docker.elastic.co/kibana/kibana:${VERSION}\n    container_name: kibana\n    ports:\n      - 5601:5601\n    environment:\n      ELASTICSEARCH_URL: http://elasticsearch:9200\n      ELASTICSEARCH_USERNAME: ${ELASTIC_USERNAME}\n      ELASTICSEARCH_PASSWORD: ${ELASTIC_PASSWORD}\n      ADMIN_PRIVILEGES: \"true\"\n    networks:\n      - elastic\n\nvolumes:\n  elastic_volume:\n    driver: local\n\nnetworks:\n  elastic:\n    driver: bridge\n```\n\nThe `.env` file cointains: \n\n```bash\nVERSION=7.8.0\nELASTIC_USERNAME=elastic\nELASTIC_PASSWORD=elastic\n```\n\nOnce the container is up you can validate every unit test:\n\n```bash\npython -m unittest tests.tests \n```\n\n## Contributing\nYes fella, you know how ;)\n\n## Contact Me\n\nMy blog: [cr0wg4n](https://cr0wg4n.medium.com/)\n\nTwitter: [cr0wg4n](https://twitter.com/cr0wg4n)\n\nLinkedin: [cr0wg4n](https://www.linkedin.com/in/cr0wg4n/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcr0wg4n%2Fkibana-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcr0wg4n%2Fkibana-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcr0wg4n%2Fkibana-api/lists"}