https://github.com/graphaelli/ipython-elasticsearch
Elasticearch IPython magic
https://github.com/graphaelli/ipython-elasticsearch
Last synced: 11 months ago
JSON representation
Elasticearch IPython magic
- Host: GitHub
- URL: https://github.com/graphaelli/ipython-elasticsearch
- Owner: graphaelli
- Created: 2015-12-12T12:45:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-09-28T18:31:38.000Z (over 7 years ago)
- Last Synced: 2025-04-04T21:51:08.544Z (about 1 year ago)
- Language: Jupyter Notebook
- Size: 197 KB
- Stars: 25
- Watchers: 4
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
=====================
ipython-elasticsearch
=====================
:Author: Gilad Raphaelli, http://g.raphaelli.com
Adds %elasticsearch magic.
Examples
--------
.. image:: notebook.png
:height: 1009 px
:width: 1103 px
:scale: 100%
:alt: notebook example
:align: center
:target: Learn%20Elasticsearch%20with%20Jupyter.ipynb
.. code-block:: python
In [1]: %load_ext elasticsearch
In [2]: %%elasticsearch
...: PUT twitter
...: {
...: "mappings": {
...: "tweet": {
...: "properties": {
...: "message": {
...: "type": "string"
...: }
...: }
...: }
...: }
...: }
...:
Out[2]: {'acknowledged': True}
Defaults endpoint http://localhost:9200::
In [3]: %elasticsearch
Using: http://localhost:9200/
Configure endpoint for the whole notebook::
In [4]: %elasticsearch http://my.host.es:1234/
Using: http://my.host.es:1234/
In [5]: %elasticsearch
Using: http://my.host.es:1234/
In [6]: %elasticsearch http://localhost:9200/
Using: http://localhost:9200/
Use a different endpoint for one cell::
In [7]: %%elasticsearch http://my.host.es:1234/
GET /
Out[7]:
{'cluster_name': 'elasticsearch',
'name': 'my.host.es',
'tagline': 'You Know, for Search',
'version': {'build_hash': 'de54438d6af8f9340d50c5c786151783ce7d6be5',
'build_snapshot': False,
'build_timestamp': '2015-10-22T08:09:48Z',
'lucene_version': '5.2.1',
'number': '2.0.0'}}
In [8]: %elasticsearch
Using: http://localhost:9200/
Installing
----------
Install the lastest release with::
pip install ipython-elasticsearch
or clone from https://github.com/graphaelli/ipython-elasticsearch and::
cd ipython-elasticsearch
python setup.py install
Development
-----------
https://github.com/graphaelli/ipython-elasticsearch
Todo
----
- configurables
- default elasticsearch endpoint
- renderjson styles
- appropriate default output in console
- contextual help
Credit
------
- https://github.com/catherinedevlin/ipython-sql for serving as a template
- http://caldwell.github.io/renderjson/ for the collapsable JSON rendering