netzkolchose / elastipy Goto Github PK
View Code? Open in Web Editor NEWpython elasticsearch query module for easily accessing nested aggregations and such
License: Other
python elasticsearch query module for easily accessing nested aggregations and such
License: Other
e.g. make that possible:
(Search.
.metric_x()
.metric_y(return_self=True)
.execute().df())
currently raises: Can not call dict_rows() on non-bucket aggregation Aggregation('a0', 'x')
ES 8 comes with security by default which is a bit annoying because it's not well documented how to tune the Elasticsearch python client.
However! First try to make the unittests pass by disabling security for the ES 8 node
Below is an example of an elastipy query that is written out for clarity. Usually it's created generative via for-loops.
In any case, it does not create the expected query DSL.
from elastipy import Search, query
Search() & (
(
~query.Term("channel_id", "channel-1")
| query.Range("timestamp", gte="2021-01-01")
)
& (
(
query.Term("channel_id", "channel-1")
& query.Term("fulfillment_by", "self")
)
| (
query.Term("channel_id", "channel-1")
& query.Term("fulfillment_by", "other")
)
)
)
e.g. the above results in
{
"bool": {
"must": [
{
"match_all": {}
},
{
"bool": {
"should": [
{
"bool": {
"must_not": [
{
"term": {
"channel_id": {
"value": "channel-1"
}
}
}
]
}
},
{
"range": {
"timestamp": {
"gte": "2021-01-01"
}
}
},
{
"bool": {
"must": [
{
"term": {
"channel_id": {
"value": "channel-1"
}
}
},
{
"term": {
"fulfillment_by": {
"value": "self"
}
}
}
]
}
},
{
"bool": {
"must": [
{
"term": {
"channel_id": {
"value": "channel-1"
}
}
},
{
"term": {
"fulfillment_by": {
"value": "other"
}
}
}
]
}
}
]
}
}
]
}
}
using parking-data export:
(search().terms("place_id", valid_place_ids)
.agg_terms("place",field="place_id", size=1000)
.agg_date_histogram("week", calendar_interval="week")
.metric_avg("free", field="num_free")
.pipeline_derivative("grad", buckets_path="free")
.execute()
.dict_rows()
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.