赞
踩
剩余磁盘空间达到es最小值,添加数据被block
PUT _all/_settings
{"index.blocks.read_only_allow_delete": null}
解除每次search最大10000size的限制
PUT [xxx]/_settings
{
"max_result_window" : 20000
}
删除单个index全部内容
DELETE /new_listings_investment
{ "query": { "match_all": {} } }
python-elasticsearch 写入geo-shape mapping
es.indices.delete(index='【index】', ignore=[400, 404])
es.indices.create(index='【index】',ignore=True)
mapping = {u'location': {'type': u'geo_shape'},'area':{'type':'object'}}
es.indices.put_mapping("【type】", {'properties': mapping}, ["【index】"])
range 过滤
range过滤允许我们按照指定范围查找一批数据:
{
"range": {
"age": {
"gte": 20,
"lt": 30
}
}
}
范围操作符包含:
* gt :: 大于
* gte:: 大于等于
* lt :: 小于
* lte:: 小于等于
一个完整的例子, 请求页面耗时大于1秒的数据,upstream_response_time 是 nginx 日志中的耗时,ES中是数字类型。
{
"query": {
"range": {
"upstream_response_time": {
"gt": 1
}
}
}
}
elasticsearch geo-shape匹配
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-query.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。