taowen / es-monitor Goto Github PK
View Code? Open in Web Editor NEWquery metric from elasticsearch using sql
query metric from elasticsearch using sql
是否支持
seletc sum(a)/sum(b)
这种聚合后结果相除的sql表达式呢
我知道es的bucket_script应该可以写出来 但是不知道sql的方式是否可以
看中文文档例子里没有涉及
It just clears up any ambiguity for usage. Many thanks :)
do you have plan on integrating with sqlalchemy
python setup.py install
Traceback (most recent call last):
File "setup.py", line 35, in
include=('es_sql*', )
TypeError: find_packages() got an unexpected keyword argument 'include'
Hi Taowen,
I am getting error while executing my code(Code is given below). I am using python 2.7. Please help me to solve the issue.
import es_sql
test = es_sql.execute_sql('http://127.0.0.1:9200', 'select city from mtmaster where city = "Leon"')
Traceback (most recent call last):
File "C:/Users/User/PycharmProjects/Practice/elasticsearch_sql.py", line 2, in
test = es_sql.execute_sql('http://127.0.0.1:9200', 'select city from mtmaster where city = "Leon"')
File "C:\Python27\lib\site-packages\es_sql\es_query.py", line 43, in execute_sql
result_map['result'] = create_executor(current_sql_selects, result_map).execute(es_url, arguments)
File "C:\Python27\lib\site-packages\es_sql\executors\select_from_leaf_executor.py", line 35, in execute
response = select_from_system.execute(es_url, self.sql_select) or search_es(url, self.request, arguments)
File "C:\Python27\lib\site-packages\es_sql\executors\select_from_leaf_executor.py", line 109, in search_es
resp = urllib2.urlopen(url, json.dumps(request)).read()
File "C:\Python27\lib\urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 435, in open
response = meth(req, response)
File "C:\Python27\lib\urllib2.py", line 548, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python27\lib\urllib2.py", line 473, in error
return self._call_chain(*args)
File "C:\Python27\lib\urllib2.py", line 407, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 556, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 406: Not Acceptable
Would be great to know if this might support Python 3?
工作地点:
北京市
岗位描述:
任职资格:
所属部门 基础平台部 章文嵩
不知是否感兴趣? @LiboDing @jakeslee @cooerson @iYUYUE @wwek @otbzi @cloudtrends @oulan @cwbhhjl @tcdona @zhiyue @temberature @summerwish @zoowii @shunix @jimbray @jumping @min520li @outofbound @crystoneme @pandyxu @caizixian @tclh123 @kyalipay @ultimate010 @lsw0794 @zhaochunqi @ProgramCaiCai @justinlm @xophiix @jun9 @keyeMyria @Xronger @duyamin @edisonh @wangjieest @lvyaojia @alexzhang2015 @zdj2006 @vincenttone @scientist2009 @eastlhu
Hey,
I would be great if you could add support for python3.
➜ explorer-ui git:(master) npm run dev
explorer-ui@ dev /Users/langge/dev/test/java/es/es-monitor/explorer-ui
node build/dev-server.js
Listening at http://localhost:8080
webpack built 79bfc92743887b702f54 in 3711ms
Hash: 79bfc92743887b702f54
Version: webpack 1.14.0
Time: 3711ms
Asset Size Chunks Chunk Names
app.js 1.16 MB 0 app
ERROR in ./src/components/Query.vue
error semi Extra semicolon
/Users/langge/dev/test/java/es/es-monitor/explorer-ui/src/components/Query.vue:31:67
this.$set('response', JSON.stringify(response.data));
^
✖ 1 problem (1 error, 0 warnings)
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 1.47 MB 0
webpack: bundle is now VALID.
<<<<<<<<<<<<<<<<<<<<<<<<<<<
➜ explorer-ui git:(master) npm install
npm WARN [email protected] requires a peer of babel-runtime@^6.0.0 but none was installed.
➜ explorer-ui git:(master)
http://localhost:8080 was broken
indices为这样的数据 zone code colo count
我想计算出每个zone code >400的数量 占每zone的总数的百分比
with all_data as (select zone, sum(count) t1 from dd group by zone)
with all_fail as (select zone,sum(count) t2 from dd where code > 400 group by zone )
select all_fail.t2 /all_data.t1 from all_data join all_fail on all_data.zone = all_fail.zone
我看好象是不支持这样的查询,求助
cat << EOF | python -m es_sql http://xxxxxxxxxxxxxxxxx
SELECT shares_count, COUNT(*) FROM symbol GROUP BY floor(market_cap / last_sale / 1000000) AS shares_count ORDER BY shares_count LIMIT 3
EOF
解释成了这个:
{
"aggs": {
"shares_count": {
"terms": {
"size": 3,
"order": {
"_key": "asc"
},
"script": {
"lang": "expression",
"inline": "floor(doc['market_cap'].value / doc['last_sale'].value/1000000)"
}
},
"aggs": {}
}
},
"size": 0
}
应该是:
{
"aggs": {
"shares_count": {
"terms": {
"size": 3,
"order": {
"_term": "asc"
},
"script": {
"lang": "expression",
"inline": "floor(doc['market_cap'].value / doc['last_sale'].value / 1000000)"
}
},
"aggs": {}
}
},
"size": 0
}
这个吧
问题在 order 那
As HTTP Api Start http server (gunicorn) have some error:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/hdfs/danier/project/es-monitor/explorer/main.py", line 14, in
'--error-logfile', 'log/error.log'] + sys.argv[1:])
TypeError: coercing to Unicode: need string or buffer, NoneType found
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.