elastic search head 基本用法
es 安装方法: http://knight-black-bob.iteye.com/blog/2259836
资源监控和集群管理插件
bin/plugin -install lukas-vlcek/bigdeskhttp://192.168.13.140:9200/_plugin/bigdesk
数据查询插件
bin/plugin -install mobz/elasticsearch-headhttp://192.168.13.140:9200/_plugin/head/
理解性:
_index 类似 mysql中 database
_type 类似 mysql 中 table
_ id 类似 mysql 中 id
插入测试数据
使用 put http://192.168.13.140:9200/baoyou/10120/17_2/
{
"token_id": 17,
"type_id": 1,
"tag_desc": "test data",
"insert_time": "20151202",
"tag_id": 2
}
使用 put http://192.168.13.140:9200/baoyou/10120/17_1/
{
"token_id": 17,
"type_id": 1,
"tag_desc": "test data",
"insert_time": "20151202",
"tag_id": 1
}
2.删除数据
3.查询语句
{ "size": 5, "query": { "bool": { "should": [ { "match": { "tag_id": 2 } }, { "match": { "tag_id": 1 } } ] } }, "aggs": { "hello": { "terms": { "field": "token_id" } } }}
4.更新数据
更新数据 version 有所改变
elastic search head 基本用法2
{ "size": 0, "query": { "bool": { "must": [ { "match": { "os": "iOS" } } ] } }, "aggs": { "hello": { "terms": { "field": "device_resolution" } } }}
{"took": 23,"timed_out": false,"_shards": {"total": 5,"successful": 5,"failed": 0},"hits": {"total": 25187,"max_score": 0,"hits": [ ]},"aggregations": {"hello": {"doc_count_error_upper_bound": 0,"sum_other_doc_count": 0,"buckets": [{"key": "667*375","doc_count": 9379},{"key": "568*320","doc_count": 8302},{"key": "736*414","doc_count": 4475},{"key": "480*320","doc_count": 3030},{"key": "755*425","doc_count": 1}]}}}
1. term 分词
term 分词, long int 类型 , 17 的 分词就是 17 , string 类型 为 空格 分割的单词 。 test data 分词之后是 test ,data . 【test data】 不是
-
- {"query":{"bool":{"must":[{"term":{"10120.tag_desc":"data"}}],"must_not":[],"should":[{"term":{"10120.tag_desc":"test"}}]}},"from":0,"size":10,"sort":[],"facets":{}}:
-
2.range
- {"query":{"bool":{"must":[{"range":{"10120.token_id":{"from":"1","to":"18"}}}],"must_not":[],"should":[]}},"from":0,"size":10,"sort":[],"facets":{}}:
range 区间 范围 只对整形 有作用 ,string 无效。
3.fuzzy
-
- {"query":{"bool":{"must":[],"must_not":[],"should":[{"fuzzy":{"10120.token_id":{"value":"1","min_similarity":"20"}}}]}},"from":0,"size":10,"sort":[],"facets":{}}:
-
- fuzzy 区间 value +- min_similarity 本 实例中 是 -19 ~21 之间。
4.query_string
query_string 可以对 int long string 进行 查询。
对 int long 只能 本身查询
对 string 进行 分词查询 本身 也可以查询。
5. miss
对 那列中 没有 值的列 进行显示。
6. prefix
prefix 前缀查询
7. wildcard
-
- {"query":{"bool":{"must":[],"must_not":[],"should":[{"wildcard":{"10120.tag_desc":"t*"}}]}},"from":0,"size":10,"sort":[],"facets":{}}:
-
wildcard 通配符
捐助开发者
在兴趣的驱动下,写一个免费
的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。