learn Elasticsearch
fs1360472174 / elasticsearchlearning Goto Github PK
View Code? Open in Web Editor NEWlearn Elasticsearch
learn Elasticsearch
term的任何结构体查询都很快?
问题:
时间范围为8.01-8.30但是后面的时间没有
一开始以为是es查询问题,后来发现是数据问题,过滤字段在8-15后面没有该字段。
导致问题
header plugin中不支持删除文档
直接删除了
curl -XDELETE 'localhost:9200/event-index/test/_query?pretty' -d '{"query":{"bool":{"filter":[{"term":{"uniqueId":"1505882147000-7482292-101"}}]}}}'
https://www.ibm.com/developerworks/cn/java/j-use-elasticsearch-java-apps/
Relational DB -> Databases -> Tables -> Rows -> Columns
Elasticsearch -> Indices -> Types -> Documents -> Fields
install elastic search
install git shell for curl
创建一个索引
curl -XPUT "127.0.0.1:9200/test/"
插入一个文档
` curl -XPUT "127.0.0.1:9200/test/user/1" -d '{"name": "name1","id": "1","address": "hanghzou"}'`
查询 文档
curl -XGET "127.0.0.1:9200/test/user/1"
{"_index":"test","_type":"user","_id":"1","_version":1,"found":true,"_source":{"name": "name1","id": "1","address": "hanghzou"}}
·curl -XGET "127.0.0.1:9200/test/user/_search?q=user:'name'"
{
“query”: {
"match" : {
}
}
}
PUT 请求创建index不可以,只能post
No handler found for uri [/info/user/] and method [PUT]
Caused by: QueryPhaseExecutionException[Result window is too large, from + size must be less than or equal to: [10000] but was [10100]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level parameter.]
{
"query": {
"filtered": {
"filter": {
"missing": {
"field": "name"
}
}
}
}
}
不存在name字段的文档
区别,为什么需要多一层
为什么不能不是ES 作为数据存储
搜索包括模糊查询
按时间的去更新
这个可能的一个潜在问题时,更新瞬时量很大的时候,系统会崩溃
按量去更新
更新不及时,
对于结构化查询,需要去查找准确值,这时候需要使用过滤器,
因为过滤器比较快,不用去计算匹配的相关性,而且容易被缓存
注 这边的准确值含义和SQL中的意义还是不同,对于String类型的字段,它表示的还是
字符串匹配,是including而不是equal 所以通常查询过程中还是需要其他的字段匹配
2. bool联合查询: must,should,must_not
过滤顺序
https://es.xiaoleilu.com/080_Structured_Search/45_filter_order.html
无法实现 distinct(id),name 这样的查询
只能查到id
类型(Type)相当于数据库中的table概念,
mapping是针对 Type 的。同一个索引里可以包含多个 Type。
Mapping 相当于数据库中的schema,用来约束字段的类型,不过 Elasticsearch 的 mapping 可以自动根据数据创建。
Allocation 分配
将分片分配给某个节点的过程,包括分配主分片或者副本
es 按照条件聚合后,没法分页
只能在应用中分页
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.