scottydelta / esq

A python package that provides GraphQL API for Elasticsearch and makes it easier to query data without writing complex queries.

Home Page:https://pypi.org/project/esq/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

esq

Build Status [pypi] Documentation Status

Install - Init - Usage - Documentation

A python package that provides GraphQL API for Elasticsearch and makes it easier to query data without writing complex queries.

Install

pip install esq

Init

>>> from esq import Esq
>>> from elasticsearch import Elasticsearch

# init your Elasticsearch client object here
>>> ELASTICSEARCH_URI = "http://localhost:9200"
>>> es_client = Elasticsearch([ELASTICSEARCH_URI])

# init your Esq object here
>>> esq = Esq(es_client)

# now you can start making queries

Usage

# to get aggregation on sentiment field on your twitter index, you can simply do:
>>> sentiments = esq.get_aggr_data(index='twitter',
                        data_type='keyword/text', #data_type is an enum('keyword/text', 'coordinates', 'timeseries')
                        data_field='sentiment')

>>> print(sentiments)
[{'label': 'positive', 'value': 9}, {'label': 'neutral', 'value': 7}, {'label': 'negative', 'value': 1}]

Documentation

Read the full usage documentation here

About

A python package that provides GraphQL API for Elasticsearch and makes it easier to query data without writing complex queries.

https://pypi.org/project/esq/

License:Other


Languages

Language:Python 80.4%Language:Makefile 19.6%