elasticsearch 自定义routing
由于线上elasticsearch集群数据量越来越大,优化已经已经是重中之重。
优化的方式有很多中,网上一大堆,自行百度。
优化方案中有个叫routing的方案是个需要熟悉业务日志才能使用。于是我就研究了routing方式。
网上有一大堆routing 的方法。但是大部分都是在mapping中加入_routing,required,path等参数工作的,但是我使用后发现有错误。如下:
reason": Mapping definition for [_routing] has unsupported parameters: [path : category]"
查看官网后发现: 原来在es2.0之后就不支持这种方式了。
所以我通过这种方法:
logstash 中指定routing的字段,然后插入到es中,es中不做任何设置。
下面是我logstash的output部分:
output {
if [type] == "dsq-info" {
elasticsearch {
hosts => ["10.1.0.12:9200"]
index => "%{[fields][index]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
routing => "%{category}" ###这里是关键字,你选择使用那个字段做索引。
}
}
}
然后在kifana中指定routing查询。
GET ****/_search?routing=api ###routing指定是字段中具体的值。
elasticsearch 自定义routing的更多相关文章
- elasticsearch 自定义_id
elasticsearch 自定义ID: curl -s -XPUT localhost:9200/web -d ' { "mappings": { "blog" ...
- Elasticsearch 自定义多个分析器
分析器(Analyzer) Elasticsearch 无论是内置分析器还是自定义分析器,都由三部分组成:字符过滤器(Character Filters).分词器(Tokenizer).词元过滤器(T ...
- Elasticsearch 自定义映射
尽管在很多情况下基本域数据类型 已经够用,但你经常需要为单独域自定义映射 ,特别是字符串域.自定义映射允许你执行下面的操作: 全文字符串域和精确值字符串域的区别 使用特定语言分析器 优化域以适应部分匹 ...
- ElasticSearch自定义分析器-集成结巴分词插件
关于结巴分词 ElasticSearch 插件: https://github.com/huaban/elasticsearch-analysis-jieba 该插件由huaban开发.支持Elast ...
- elasticsearch 自定义similarity 插件开发
转自:http://www.chepoo.com/elasticsearch-similarity-custom-plug-in-development.html 在搜索开发中,我们要修改打分机制,就 ...
- Elasticsearch自定义分析器
关于分析器 ES中默认使用的是标准分析器(standard analyzer).如果需要对某个字段使用其他分析器,可以在映射中该字段下说明.例如: PUT /my_index { "mapp ...
- elasticsearch自定义动态映射
https://www.elastic.co/guide/cn/elasticsearch/guide/current/custom-dynamic-mapping.html如果你想在运行时增加新的字 ...
- ElasticSearch——自定义模板
output中配置 elasticsearch{ action => "index" hosts => ["xxx"] index => &q ...
- ElasticSearch 自定义排序处理
使用function_score进行分组处理,利用分组函数script_score进行自定义分值处理, 注意:使用script功能需要在配置中打开脚本功能: script.inline: on s ...
随机推荐
- ThreadLocal是什么?
早在JDK 1.2的版本中就提供Java.lang.ThreadLocal,ThreadLocal为解决多线程程序的并发问题提供了一种新的思路.使用这个工具类可以很简洁地编写出优美的多线程程序. 当使 ...
- dfs(学姐的红包)
链接:https://ac.nowcoder.com/acm/contest/3402/I 盼啊,盼啊,伴随着时钟的敲响,我们即将迎来了美好的传统佳节-春节.为了给新年增添浓浓节日气息,师弟师妹 ...
- C语言-switch语句的使用。对文件的输出处理。for循环和if的结合使用。
//函数fun功能:统计字符串中各元音字母的个数,注意:不区分大小写. //重难点:switch语句的使用. #include <stdlib.h> #include <conio. ...
- SpringBoot 系列
https://my.oschina.net/xiedeshou?tab=newest&catalogId=5936801 SpringBoot | 第零章:前言 SpringBoot | 第 ...
- SQL 查询每组的第一条记录
CREATE TABLE [dbo].[test1]( [program_id] [int] NULL, [person_id] [int] NULL ) ON [PRIMARY] /*查询每组分组中 ...
- Spring Boot JPA 使用教程
JPA 是 Spring Boot 官方推荐的数据库访问组件,其充分体现了面向对象编程思想,有点像 asp.net 的 EFCore.JPA 也是众多 ORM 的抽象. 从本系列开始,都需要用到 my ...
- SpringBoot与Mybatis整合(包含generate自动生成代码工具,数据库表一对一,一对多,关联关系中间表的查询)
链接:https://blog.csdn.net/YonJarLuo/article/details/81187239 自动生成工具只是生成很单纯的表,复杂的一对多,多对多的情况则是在建表的时候就建立 ...
- BGP前缀过滤(正则表达式)
BGP的正则表达式一般用在as-path中,常用的如下: .(点):表示匹配任意一个字符,包括空格. *:表示匹配零个或多个模式的出现.即前一个字符出现0次或多次. +:表示匹配一个或多个模式的出现. ...
- Codeforces Round #621 (Div. 1 + Div. 2) C. Cow and Message
Bessie the cow has just intercepted a text that Farmer John sent to Burger Queen! However, Bessie is ...
- 【转】django 三件套(render,redirect,HttpResponse)
Django基础必备三件套**: HttpResponse 内部传入一个字符串参数,返回给浏览器. from django.shortcuts import HttpResponse def inde ...