1 2 3 4 5 ··· 9 下一页
摘要: 索引:相当于数据库,ElasticeSearch 有1个或多个Lucene 索引构成。 文档:相当于数据库的行,由一个或多个字段组成。 类型:相当于数据库表 映射:存储分析链所需的所有信息 节点:单个ElasticSearch 实例被称为节点(Node),很多时候数据访问量很大,单机无法应付,就需要 阅读全文
posted @ 2017-12-27 20:42 小蚕豆 阅读(415) 评论(0) 推荐(0) 编辑
摘要: Cluster Health Wait for status You can use the cluster health API to wait for a specific status for the whole cluster or for a given index: client.adm 阅读全文
posted @ 2017-12-27 20:03 小蚕豆 阅读(737) 评论(0) 推荐(0) 编辑
摘要: static final Builder builder = Settings.builder().put("index.analysis.search_analyzer.default.type", "ik_smart") .put("index.analysis.analyzer.default 阅读全文
posted @ 2017-12-27 19:59 小蚕豆 阅读(2088) 评论(0) 推荐(0) 编辑
摘要: Bool Query 用于组合多个叶子或复合查询子句的默认查询 must 相当于 与 & = must not 相当于 非 ~ != should 相当于 或 | or filter 过滤 SearchRequest sr = new SearchRequest(); //指定索引名称,如未指定则会 阅读全文
posted @ 2017-12-27 19:34 小蚕豆 阅读(14287) 评论(1) 推荐(0) 编辑
摘要: 一、term query 精确查询 不分词 二、terms query 相当于 IN 查询 三、range query 范围查询 四、exists query 类似于SQL语句中的IS_NULL exists 和 missing 过滤可以用于查找文档中是否包含指定字段或没有某个字段,类似于SQL语句 阅读全文
posted @ 2017-12-26 18:56 小蚕豆 阅读(905) 评论(0) 推荐(0) 编辑
摘要: 上面的查询匹配就会进行分词,比如"宝马多少马力"会被分词为"宝马 多少 马力", 所有有关"宝马 多少 马力", 那么所有包含这三个词中的一个或多个的文档就会被搜索出来。并且根据lucene的评分机制(TF/IDF)来进行评分。 { "query_string":{ "default_field": 阅读全文
posted @ 2017-12-26 18:53 小蚕豆 阅读(651) 评论(0) 推荐(0) 编辑
摘要: GET /index/type/_search { "size" : 0, "aggs": { "agg_sex": { "terms": { "field": "sex" }, "agg_age": { "avg_age": { "avg": { "field": "age&q 阅读全文
posted @ 2017-12-26 17:57 小蚕豆 阅读(1529) 评论(0) 推荐(0) 编辑
摘要: 一、根据索引、类型、ID 获取多文档 MultiGetResponse multiGetItemResponses = client.prepareMultiGet() .add("twitter", "tweet", "1") .add("twitter", "tweet", "2", "3", 阅读全文
posted @ 2017-12-26 16:58 小蚕豆 阅读(753) 评论(0) 推荐(0) 编辑
摘要: import static org.elasticsearch.common.xcontent.XContentFactory.*; BulkRequestBuilder bulkRequest = client.prepareBulk(); // either use client#prepare 阅读全文
posted @ 2017-12-26 16:58 小蚕豆 阅读(375) 评论(0) 推荐(0) 编辑
摘要: 一、修改部分字段By UpdateRequest client.prepareUpdate("ttl", "doc", "1") .setScript(new Script("ctx._source.gender = \"male\"" , ScriptService.ScriptType.INLI 阅读全文
posted @ 2017-12-26 16:24 小蚕豆 阅读(15652) 评论(0) 推荐(0) 编辑
1 2 3 4 5 ··· 9 下一页