Hello,World

社区日报 第191期 (2018-02-23)

1.ELK玩转你的支付宝账单
http://t.cn/R8e5Gfl
2.推荐 | kibana索引信息可视化插件
http://t.cn/REhrlVK
3.支持增删改查一个简单的Lucene工具类
https://elasticsearch.cn/article/500 

编辑: 铭毅天下
归档: https://elasticsearch.cn/article/505
订阅: https://tinyletter.com/elastic-daily
 
继续阅读 »
1.ELK玩转你的支付宝账单
http://t.cn/R8e5Gfl
2.推荐 | kibana索引信息可视化插件
http://t.cn/REhrlVK
3.支持增删改查一个简单的Lucene工具类
https://elasticsearch.cn/article/500 

编辑: 铭毅天下
归档: https://elasticsearch.cn/article/505
订阅: https://tinyletter.com/elastic-daily
  收起阅读 »

社区日报 第190期 (2018-02-22)

  1. Elasticsearch6.2新增自定义vega可视化。 http://t.cn/REh8K0O

  2. 调整Elasticsearch碎片的思考和收益。 http://t.cn/REh8C0l

  3. ES-Spark连接ES后,ES Client节点流量打满分析。 http://t.cn/REh8pXb
继续阅读 »
  1. Elasticsearch6.2新增自定义vega可视化。 http://t.cn/REh8K0O

  2. 调整Elasticsearch碎片的思考和收益。 http://t.cn/REh8C0l

  3. ES-Spark连接ES后,ES Client节点流量打满分析。 http://t.cn/REh8pXb
收起阅读 »

社区日报 第189期 (2018-02-14)

1. 日志收集工具fluentd与logstash比较。 
http://t.cn/RR9sgLX
2. 如何通过logstash将csv数据导入到elasticsearch。
http://t.cn/RCGeeJK
3. 搜索引擎选择:Elasticsearch与Solr
http://t.cn/RUncwIu
 
编辑:wt
归档:https://elasticsearch.cn/article/503
订阅:https://tinyletter.com/elastic-daily
继续阅读 »
1. 日志收集工具fluentd与logstash比较。 
http://t.cn/RR9sgLX
2. 如何通过logstash将csv数据导入到elasticsearch。
http://t.cn/RCGeeJK
3. 搜索引擎选择:Elasticsearch与Solr
http://t.cn/RUncwIu
 
编辑:wt
归档:https://elasticsearch.cn/article/503
订阅:https://tinyletter.com/elastic-daily 收起阅读 »

社区日报 第188期 (2018-02-13)

1.Elastic Stack 6.2 发布。 
http://t.cn/R8rHoet
 
2.Elasticsearch : java 9 相关改进。 
http://t.cn/RRIs0RY
 
3.别名的特殊应用 
http://t.cn/RRMPLaA
 
编辑:cyberdak
归档:https://elasticsearch.cn/article/502
订阅:https://tinyletter.com/elastic-daily
继续阅读 »
1.Elastic Stack 6.2 发布。 
http://t.cn/R8rHoet
 
2.Elasticsearch : java 9 相关改进。 
http://t.cn/RRIs0RY
 
3.别名的特殊应用 
http://t.cn/RRMPLaA
 
编辑:cyberdak
归档:https://elasticsearch.cn/article/502
订阅:https://tinyletter.com/elastic-daily 收起阅读 »

kibana如何添加添加server.xsrf.disableProtection节点

这是链接文章,其中文中提到的添加节点,具体如何操作?http://blog.csdn.net/qq_241296 ... 43845
这是链接文章,其中文中提到的添加节点,具体如何操作?http://blog.csdn.net/qq_241296 ... 43845

一个简单的Lucene工具类,通过注释的方式来配置构建索引的字段。提供新建索引、查找、删除、更新方法,支持分页。

代码地址:https://gitee.com/shaojiepeng/wsm-lucene
 ### wsm-lucene
一个简单的Lucene工具类,通过注释的方式来配置构建索引的字段。提供新建索引、查找、删除、更新方法,支持分页。

### 所需jar包
1. lucene-core:2.4.0
2. lucene-analyzers:2.4.1
3. commons-logging:1.2

### 背景
以前在做某个feature的时候,鉴于存储在DB中的数据量过大,故使用Lucene来优化查找性能。
相信大家在某些场景下会把DB中的数据读出来,建索引来优化查找。那么这个工具类就比较适合这些场景了。

### 如何使用
 **从附件中下载jar包直接导入到项目中,或者下载此Maven项目的源码,使用项目依赖的方式导入你的项目。** 

1. 通过注释的方式配置需要构建索引的model类

```
 **@IndexClass** :注释,说明此model类需要构建索引
 **indexDirPath** :索引所存放的物理位置,如:"D:/Index"

 **@IndexField** :注释,说明此字段需要构建索引
 **fieldStore** :Lucene中的Field.Store同义,不懂请自行查询资料
 **fieldIndex** :Lucene中的Field.Index同义,不懂请自行查询资料
```

173117_4fa2ac08_980808.png



2. 创建索引
```

IndexService indexService = new IndexServiceImpl();
/** 构建索引的接口
 * List:model的集合
 * Class: model的class
 *
 * return boolean
**/
indexService.buildIndex(List, Class)
```

173148_bb488cf0_980808.png



3.查找
```
ArrayList<SearchParamModel> searchParams = new ArrayList<>();
/**添加查询的条件,如果有多个查询条件,则添加SearchParamModel
 * fieldName:需要查找的字段,即model中的成员变量
 * fieldValue:需要查找字段的值,这个不解释
 * BooleanType:Lucene中BooleanClause.Occur值,不懂请自行查询资料
**/
searchParams.add(new SearchParamModel(fieldName, fieldValue, BooleanType));
IndexService indexService = new IndexServiceImpl();
/** 查询的接口
 * searchParams:不解释
 * Class: model的class
 *
 * return model的集合
**/
List objs = indexService.search(searchParams, Class);
```

173219_367ef1d0_980808.png




IndexService中还支持update, delete和分页查找的方法,请自行查阅代码。


觉得不错,请点个赞吧。
继续阅读 »
代码地址:https://gitee.com/shaojiepeng/wsm-lucene
 ### wsm-lucene
一个简单的Lucene工具类,通过注释的方式来配置构建索引的字段。提供新建索引、查找、删除、更新方法,支持分页。

### 所需jar包
1. lucene-core:2.4.0
2. lucene-analyzers:2.4.1
3. commons-logging:1.2

### 背景
以前在做某个feature的时候,鉴于存储在DB中的数据量过大,故使用Lucene来优化查找性能。
相信大家在某些场景下会把DB中的数据读出来,建索引来优化查找。那么这个工具类就比较适合这些场景了。

### 如何使用
 **从附件中下载jar包直接导入到项目中,或者下载此Maven项目的源码,使用项目依赖的方式导入你的项目。** 

1. 通过注释的方式配置需要构建索引的model类

```
 **@IndexClass** :注释,说明此model类需要构建索引
 **indexDirPath** :索引所存放的物理位置,如:"D:/Index"

 **@IndexField** :注释,说明此字段需要构建索引
 **fieldStore** :Lucene中的Field.Store同义,不懂请自行查询资料
 **fieldIndex** :Lucene中的Field.Index同义,不懂请自行查询资料
```

173117_4fa2ac08_980808.png



2. 创建索引
```

IndexService indexService = new IndexServiceImpl();
/** 构建索引的接口
 * List:model的集合
 * Class: model的class
 *
 * return boolean
**/
indexService.buildIndex(List, Class)
```

173148_bb488cf0_980808.png



3.查找
```
ArrayList<SearchParamModel> searchParams = new ArrayList<>();
/**添加查询的条件,如果有多个查询条件,则添加SearchParamModel
 * fieldName:需要查找的字段,即model中的成员变量
 * fieldValue:需要查找字段的值,这个不解释
 * BooleanType:Lucene中BooleanClause.Occur值,不懂请自行查询资料
**/
searchParams.add(new SearchParamModel(fieldName, fieldValue, BooleanType));
IndexService indexService = new IndexServiceImpl();
/** 查询的接口
 * searchParams:不解释
 * Class: model的class
 *
 * return model的集合
**/
List objs = indexService.search(searchParams, Class);
```

173219_367ef1d0_980808.png




IndexService中还支持update, delete和分页查找的方法,请自行查阅代码。


觉得不错,请点个赞吧。 收起阅读 »

社区日报 第187期 (2018-02-12)

1.Scrapy分布式爬虫打造搜索引擎系列。
http://t.cn/RR5w7uJ 
2.kibana-6建立可视化图表前的前期准备工作。
http://t.cn/RR5Z4du 
3.使用Curator管理Elasticsearch的索引。
http://t.cn/RR5Zxso 

编辑:叮咚光军
归档:https://elasticsearch.cn/article/499 
订阅:https://tinyletter.com/elastic-daily 
 
继续阅读 »
1.Scrapy分布式爬虫打造搜索引擎系列。
http://t.cn/RR5w7uJ 
2.kibana-6建立可视化图表前的前期准备工作。
http://t.cn/RR5Z4du 
3.使用Curator管理Elasticsearch的索引。
http://t.cn/RR5Zxso 

编辑:叮咚光军
归档:https://elasticsearch.cn/article/499 
订阅:https://tinyletter.com/elastic-daily 
  收起阅读 »

elasticsearch源码导入intellij

环境准备:
   windows10,jdk1.8,elasticsearch-6.1.3,gradle-4.5,intellij
过程:
   1:从github上下载elasticsearch-6.1.3版本,并且解压
   2:安装gradle配置环境变量
   3:进入elasticsearch目录执行:gradle idea命令
   4:使用intellij导入elasticsearch项目
 
继续阅读 »
环境准备:
   windows10,jdk1.8,elasticsearch-6.1.3,gradle-4.5,intellij
过程:
   1:从github上下载elasticsearch-6.1.3版本,并且解压
   2:安装gradle配置环境变量
   3:进入elasticsearch目录执行:gradle idea命令
   4:使用intellij导入elasticsearch项目
  收起阅读 »

社区日报 第186期 (2018-02-11)

1.如何用Kibana监控AdroitLogic ESB(UltraESB-X)。
http://t.cn/RRbOoII
2.分析3个月的未读电子邮件。
http://t.cn/RRbMyR8
3.(自备梯子)使用ELK堆栈实现客户智能。
http://t.cn/RRbx2XL

编辑:至尊宝
归档:https://elasticsearch.cn/article/497
订阅:https://tinyletter.com/elastic-daily
继续阅读 »
1.如何用Kibana监控AdroitLogic ESB(UltraESB-X)。
http://t.cn/RRbOoII
2.分析3个月的未读电子邮件。
http://t.cn/RRbMyR8
3.(自备梯子)使用ELK堆栈实现客户智能。
http://t.cn/RRbx2XL

编辑:至尊宝
归档:https://elasticsearch.cn/article/497
订阅:https://tinyletter.com/elastic-daily 收起阅读 »

推荐indies_view 插件

indies_view

https://github.com/TrumanDu/indices_view

An awesome kibana plugin for view indies! 这个是一个可以查看indices 相关信息的kibana plugin ,欢迎大家使用,或者提出宝贵的经验


Screenshots

indices_view.gif

Reg pattern

1. /[^a-z] $/
2. /[\d]{4}[-|\.|/][\d]{1,2}[-|\.|/][\d]{1,2}/

Development

See the kibana contributing guide for instructions setting up your development environment. Once you have completed that, use the following npm tasks.

  • npm start

Start kibana and have it include this plugin

  • npm start -- --config kibana.yml

You can pass any argument that you would normally send to bin/kibana by putting them after -- when running npm start

  • npm run build

Build a distributable archive

  • npm run test:browser

Run the browser tests in a real web browser

  • npm run test:server

Run the server tests using mocha

For more information about any of these commands run npm run ${task} -- --help.

Deploy

important : edit this plugin version and kibana.version to you kibana version in package.json

  • npm install
  • npm run build

Build a distributable archive

Install

  1. cp to docker container

$ sudo docker cp ****.zip id:/****.zip

  1. install to kibana

$bin/kibana-plugin install file:///****.zip

继续阅读 »

indies_view

https://github.com/TrumanDu/indices_view

An awesome kibana plugin for view indies! 这个是一个可以查看indices 相关信息的kibana plugin ,欢迎大家使用,或者提出宝贵的经验


Screenshots

indices_view.gif

Reg pattern

1. /[^a-z] $/
2. /[\d]{4}[-|\.|/][\d]{1,2}[-|\.|/][\d]{1,2}/

Development

See the kibana contributing guide for instructions setting up your development environment. Once you have completed that, use the following npm tasks.

  • npm start

Start kibana and have it include this plugin

  • npm start -- --config kibana.yml

You can pass any argument that you would normally send to bin/kibana by putting them after -- when running npm start

  • npm run build

Build a distributable archive

  • npm run test:browser

Run the browser tests in a real web browser

  • npm run test:server

Run the server tests using mocha

For more information about any of these commands run npm run ${task} -- --help.

Deploy

important : edit this plugin version and kibana.version to you kibana version in package.json

  • npm install
  • npm run build

Build a distributable archive

Install

  1. cp to docker container

$ sudo docker cp ****.zip id:/****.zip

  1. install to kibana

$bin/kibana-plugin install file:///****.zip

收起阅读 »

社区日报 第185期 (2018-02-10)

  1. Elasticsearch与Hbase特性对比。 http://t.cn/RRyM1vm
  2. 将Elasticsearch作为Hive的存储? http://t.cn/RRyxDNZ
  3. 基于Elasticsearch实现搜索推荐 http://t.cn/RRyJiHx
继续阅读 »
  1. Elasticsearch与Hbase特性对比。 http://t.cn/RRyM1vm
  2. 将Elasticsearch作为Hive的存储? http://t.cn/RRyxDNZ
  3. 基于Elasticsearch实现搜索推荐 http://t.cn/RRyJiHx
收起阅读 »

kibana使用geoip插件展示地图热力图

geoip1.png

上图是我们最终的地图效果。

总体步骤:

一、使用logstash geoip插件解析IP字段;

二、配置geoip.location字段为geo_point类型。

三、使用kibana的Coordinate map作图。

具体步骤:

一、解析IP字段

使用logstash的geoip插件 logstash-filter-geoip 解析IP字段,需要在logstash的配置文件中配置geoip的解析配置,配置如下:

geoip {
       source => "ip" //需要解析的IP地址
      }

解析出的效果如下:

"geoip": {
      "city_name": "Wuhan",
      "timezone": "Asia/Shanghai",
      "ip": "117.136.52.200",
      "latitude": 30.5801,
      "country_name": "China",
      "country_code2": "CN",
      "continent_code": "AS",
      "country_code3": "CN",
      "region_name": "Hubei",
      "location": {
        "lon": 114.2734,
        "lat": 30.5801
      },
      "region_code": "42",
      "longitude": 114.2734
    }

备注:这个只是geoip的配置,解析日志的时候需要先解析出ip字段

二、配置geoip字段类型

IP经过logstash解析后就可以使用IP的所有解析信息了,但是如果想要在kibana中作图,就必须把geoip里面的相应信息配置成相应的字段类型,才能够被kibana识别,然后经过聚合作图。 需要配置的字段:geoip.location 需要配置的类型:geo_point 在mapping中的配置为:

"geoip" : {
          "properties" : {
            "location" : {
              "type" : "geo_point",
              "ignore_malformed": "true"  
            }
          }
        }

备注1: ignore_malformed 如果true,格式错误的地理位置被忽略。如果false(默认),格式错误的地理位置引发异常并拒绝整个文档。 此字段需要配置成true,以防地理格式错误导致文档被拒绝。 也可以在所以级别进行设置: "settings": { "index.mapping.ignore_malformed": true }

备注2:需要先设置mapping,再导入数据mapping才会生效,如果先导入数据,再设置mapping,则第二天八点后才会生效(北京时间)。

三、kibana作图

1、在kibana中打开visualize->coordinate map

geoip2.png

2、选择相应的索引进行画图

geoip3.png

3、选择geoip.location作为聚合字段,然后设置Options,调整地图效果即可。

geoip4.png

继续阅读 »

geoip1.png

上图是我们最终的地图效果。

总体步骤:

一、使用logstash geoip插件解析IP字段;

二、配置geoip.location字段为geo_point类型。

三、使用kibana的Coordinate map作图。

具体步骤:

一、解析IP字段

使用logstash的geoip插件 logstash-filter-geoip 解析IP字段,需要在logstash的配置文件中配置geoip的解析配置,配置如下:

geoip {
       source => "ip" //需要解析的IP地址
      }

解析出的效果如下:

"geoip": {
      "city_name": "Wuhan",
      "timezone": "Asia/Shanghai",
      "ip": "117.136.52.200",
      "latitude": 30.5801,
      "country_name": "China",
      "country_code2": "CN",
      "continent_code": "AS",
      "country_code3": "CN",
      "region_name": "Hubei",
      "location": {
        "lon": 114.2734,
        "lat": 30.5801
      },
      "region_code": "42",
      "longitude": 114.2734
    }

备注:这个只是geoip的配置,解析日志的时候需要先解析出ip字段

二、配置geoip字段类型

IP经过logstash解析后就可以使用IP的所有解析信息了,但是如果想要在kibana中作图,就必须把geoip里面的相应信息配置成相应的字段类型,才能够被kibana识别,然后经过聚合作图。 需要配置的字段:geoip.location 需要配置的类型:geo_point 在mapping中的配置为:

"geoip" : {
          "properties" : {
            "location" : {
              "type" : "geo_point",
              "ignore_malformed": "true"  
            }
          }
        }

备注1: ignore_malformed 如果true,格式错误的地理位置被忽略。如果false(默认),格式错误的地理位置引发异常并拒绝整个文档。 此字段需要配置成true,以防地理格式错误导致文档被拒绝。 也可以在所以级别进行设置: "settings": { "index.mapping.ignore_malformed": true }

备注2:需要先设置mapping,再导入数据mapping才会生效,如果先导入数据,再设置mapping,则第二天八点后才会生效(北京时间)。

三、kibana作图

1、在kibana中打开visualize->coordinate map

geoip2.png

2、选择相应的索引进行画图

geoip3.png

3、选择geoip.location作为聚合字段,然后设置Options,调整地图效果即可。

geoip4.png

收起阅读 »

elasticsearch.yml 个人解读

  • 属性 cluster.name 如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。
  • 属性 node.name 节点名可以忽略
  • 属性 node.master 指定该节点是否有资格被选举成为node,默认是true
  • 属性 index.number_of_shard 设置默认索引分片个数,默认为5片
  • 属性 index.number_of_replica 设置默认索引副本个数,默认为1个副本
  • 属性 path.conf 设置配置文件的存储路径,默认是es根目录下的config文件夹。
  • 属性 path.data 设置索引数据的存储路径,默认是es根目录下的data文件夹
  • 属性 path.work 设置临时文件的存储路径,默认是es根目录下的work文件夹
  • 属性 path.logs 设置日志文件的存储路径,默认是es根目录下的logs文件夹
  • 属性 path.repo 快照存储路径
  • 属性 gateway.recover_after_nodes 设置集群中N个节点启动时进行数据恢复,默认为1
  • 属性 network.host 映射出来的ip
  • 属性 transport.tcp.port 设置节点间交互的tcp端口,默认是9300
  • 属性 http.port: 9200 设置对外服务的http端口,默认为9200
  • 属性 index.number_of_replicas 索引的复制副本数量
  • 属性 indices.fielddata.cache.size fielddata缓存限制,默认无限制
  • 属性 indices.breaker.fielddata.limit fielddata级别限制,默认为堆的60% 
  • 属性 indices.breaker.request.limit request级别请求限制,默认为堆的40% 
  • 属性 indices.breaker.total.limit 保证上面两者组合起来的限制,默认堆的70%
  • 属性 discovery.zen.ping.multicast.enabled 是否广播模式,默认true,广播模式即同一个网段的ES服务只要集群名[cluster.name]一致,则自动集群
  • 属性 discovery.zen.ping.unicast.hosts 手动指定,哪个几个可以ping通的es服务做集群,注意该设置应该设置在master节点上,data节点无效

----------------------------------------------------------------------------------------------------------------------------------
GC Logging 
monitor.jvm.gc.young.warn: 1000ms
monitor.jvm.gc.young.info: 700ms
monitor.jvm.gc.young.debug: 400ms

monitor.jvm.gc.old.warn: 10s
monitor.jvm.gc.old.info: 5s
monitor.jvm.gc.old.debug: 2s
继续阅读 »
  • 属性 cluster.name 如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。
  • 属性 node.name 节点名可以忽略
  • 属性 node.master 指定该节点是否有资格被选举成为node,默认是true
  • 属性 index.number_of_shard 设置默认索引分片个数,默认为5片
  • 属性 index.number_of_replica 设置默认索引副本个数,默认为1个副本
  • 属性 path.conf 设置配置文件的存储路径,默认是es根目录下的config文件夹。
  • 属性 path.data 设置索引数据的存储路径,默认是es根目录下的data文件夹
  • 属性 path.work 设置临时文件的存储路径,默认是es根目录下的work文件夹
  • 属性 path.logs 设置日志文件的存储路径,默认是es根目录下的logs文件夹
  • 属性 path.repo 快照存储路径
  • 属性 gateway.recover_after_nodes 设置集群中N个节点启动时进行数据恢复,默认为1
  • 属性 network.host 映射出来的ip
  • 属性 transport.tcp.port 设置节点间交互的tcp端口,默认是9300
  • 属性 http.port: 9200 设置对外服务的http端口,默认为9200
  • 属性 index.number_of_replicas 索引的复制副本数量
  • 属性 indices.fielddata.cache.size fielddata缓存限制,默认无限制
  • 属性 indices.breaker.fielddata.limit fielddata级别限制,默认为堆的60% 
  • 属性 indices.breaker.request.limit request级别请求限制,默认为堆的40% 
  • 属性 indices.breaker.total.limit 保证上面两者组合起来的限制,默认堆的70%
  • 属性 discovery.zen.ping.multicast.enabled 是否广播模式,默认true,广播模式即同一个网段的ES服务只要集群名[cluster.name]一致,则自动集群
  • 属性 discovery.zen.ping.unicast.hosts 手动指定,哪个几个可以ping通的es服务做集群,注意该设置应该设置在master节点上,data节点无效

----------------------------------------------------------------------------------------------------------------------------------
GC Logging 
monitor.jvm.gc.young.warn: 1000ms
monitor.jvm.gc.young.info: 700ms
monitor.jvm.gc.young.debug: 400ms

monitor.jvm.gc.old.warn: 10s
monitor.jvm.gc.old.info: 5s
monitor.jvm.gc.old.debug: 2s 收起阅读 »

Elasticsearch mapping 配置个人解读


配置详解
文件中"mapping":{}中的内容,即为创建索引的mappingsource 如:
"mappings": {
"_default_" : { //@1
"_all" : {"enabled" : true}, //@2
"properties" : { //@3
"tableType" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, //@4
"caption" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"code" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"description" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"perm" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : false}
}
},
"ec02_goodsinfo" : { //@5
"_all" : {"enabled" : true}, //@6
"properties" : { //@7
"tableType" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"caption" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"code" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"description" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"perm" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : false},
"bill":{ //@8
properties" : {
"CreateYear" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : true} //@9
}
}
}
}
}

  • @1 _default_所有单据默认的创建索引的配置
  • @2 _all{} 每个单据下所有的字段配置,"enabled" : true 所有字段创建索引,false 所有字段禁止创建索引,[*注意]除非properties指定的字段,默认字段类型将自动匹配
  • @3 properties {},每个单据下字段或者properties的指定配置
  • @4 properties {}中指定了属性(properties):"tableType"的检索配置,type:string > 类型字符串,include_in_all:false > 改字段或者属性不包含在单据的所有字段中,"store": true > 储存在数据库中
  • @5 ec02_goodsinfo 表示对单据 "ec02_goodsinfo" 的特定检索配置
  • @6 _all{} 只对"ec02_goodsinfo"单据下所有的字段配置
  • @7 properties {},只对"ec02_goodsinfo"单据下字段或者properties的指定配置
  • [*注意]@8,@9 bill在单据中额字段都会包括一层bill,所以如果要对单据中某个字段指定需要套一层bill{}

-----------------------------------------------------------------------------------------------------------------------------------------
属性解说
版本5.X以前
  • index 可选值为analyzed(默认)和not_analyzed,如果是字段是字符串类型的,则可以是not_analyzed
  • store 可选值为yes或no,指定该字段的原始值是否被写入索引中,默认为no,即结果中不能返回该字段。
  • boost默认为1,定义了文档中该字段的重要性,越高越重要
  • null_value 如果一个字段为null值(空数组或者数组都是null值)的话不会被索引及搜索到,null_value参数可以显示替代null values为指定值,这样使得字段可以被搜索到。
  • include_in_all 指定该字段是否应该包括在_all字段里头,默认情况下都会包含。
  • type 可以指定String,long,int,doulbe,floot,boolean,等

版本5.X以后
  • 原本type string,其index 可选值为analyzed(默认)和not_analyzed,现在直接拆违type text( index analyzed),type keyword(index not_analyzed)
  • store 可选值为enable或false,指定该字段的原始值是否被写入索引中,默认为enable,即结果中不能返回该字段。
  • index 表示是否用于检索默认enable,可选false

-------------------------------------------------------------------------------------------------------------------------------
字段的数据类型
  • 简单类型string(指定分词器)
  • date(默认使用UTC保持,也可以使用format指定格式)
  • 数值类型(byte,short,integer,long,float,double)
  • boolean
  • binary(存储在索引中的二进制数据的base64表示,比如图像,只存储不索引)
  • ip(以数字形式简化IPV4地址的使用,可以被索引、排序并使用IP值做范围查询)注意string是5.x以前的,5.x之后被分裂为text,keyword


有层级结构的类型,比如object 或者 nested.
特殊类型
  • geo_point
  • geo_shape
  • completion

 
继续阅读 »

配置详解
文件中"mapping":{}中的内容,即为创建索引的mappingsource 如:
"mappings": {
"_default_" : { //@1
"_all" : {"enabled" : true}, //@2
"properties" : { //@3
"tableType" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true}, //@4
"caption" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"code" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"description" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"perm" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : false}
}
},
"ec02_goodsinfo" : { //@5
"_all" : {"enabled" : true}, //@6
"properties" : { //@7
"tableType" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"caption" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"code" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"description" : {"type" : "string", "index" : "no", "include_in_all" : false, "store": true},
"perm" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : false},
"bill":{ //@8
properties" : {
"CreateYear" : {"type" : "string", "index" : "not_analyzed", "include_in_all" : true} //@9
}
}
}
}
}

  • @1 _default_所有单据默认的创建索引的配置
  • @2 _all{} 每个单据下所有的字段配置,"enabled" : true 所有字段创建索引,false 所有字段禁止创建索引,[*注意]除非properties指定的字段,默认字段类型将自动匹配
  • @3 properties {},每个单据下字段或者properties的指定配置
  • @4 properties {}中指定了属性(properties):"tableType"的检索配置,type:string > 类型字符串,include_in_all:false > 改字段或者属性不包含在单据的所有字段中,"store": true > 储存在数据库中
  • @5 ec02_goodsinfo 表示对单据 "ec02_goodsinfo" 的特定检索配置
  • @6 _all{} 只对"ec02_goodsinfo"单据下所有的字段配置
  • @7 properties {},只对"ec02_goodsinfo"单据下字段或者properties的指定配置
  • [*注意]@8,@9 bill在单据中额字段都会包括一层bill,所以如果要对单据中某个字段指定需要套一层bill{}

-----------------------------------------------------------------------------------------------------------------------------------------
属性解说
版本5.X以前
  • index 可选值为analyzed(默认)和not_analyzed,如果是字段是字符串类型的,则可以是not_analyzed
  • store 可选值为yes或no,指定该字段的原始值是否被写入索引中,默认为no,即结果中不能返回该字段。
  • boost默认为1,定义了文档中该字段的重要性,越高越重要
  • null_value 如果一个字段为null值(空数组或者数组都是null值)的话不会被索引及搜索到,null_value参数可以显示替代null values为指定值,这样使得字段可以被搜索到。
  • include_in_all 指定该字段是否应该包括在_all字段里头,默认情况下都会包含。
  • type 可以指定String,long,int,doulbe,floot,boolean,等

版本5.X以后
  • 原本type string,其index 可选值为analyzed(默认)和not_analyzed,现在直接拆违type text( index analyzed),type keyword(index not_analyzed)
  • store 可选值为enable或false,指定该字段的原始值是否被写入索引中,默认为enable,即结果中不能返回该字段。
  • index 表示是否用于检索默认enable,可选false

-------------------------------------------------------------------------------------------------------------------------------
字段的数据类型
  • 简单类型string(指定分词器)
  • date(默认使用UTC保持,也可以使用format指定格式)
  • 数值类型(byte,short,integer,long,float,double)
  • boolean
  • binary(存储在索引中的二进制数据的base64表示,比如图像,只存储不索引)
  • ip(以数字形式简化IPV4地址的使用,可以被索引、排序并使用IP值做范围查询)注意string是5.x以前的,5.x之后被分裂为text,keyword


有层级结构的类型,比如object 或者 nested.
特殊类型
  • geo_point
  • geo_shape
  • completion

  收起阅读 »

社区日报 第184期 (2018-02-09)

1、上新 | 社区新增的PPT分享功能和100个PPT上传ok
https://elasticsearch.cn/slides/
2、Elasticsearch理性加速清单
http://t.cn/RRv93KH
3、Elasticsearch这5个错误,要避免!
http://t.cn/RRv9dw9 
 

编辑:铭毅天下
归档:https://elasticsearch.cn/article/491
订阅:https://tinyletter.com/elastic-daily
继续阅读 »
1、上新 | 社区新增的PPT分享功能和100个PPT上传ok
https://elasticsearch.cn/slides/
2、Elasticsearch理性加速清单
http://t.cn/RRv93KH
3、Elasticsearch这5个错误,要避免!
http://t.cn/RRv9dw9 
 

编辑:铭毅天下
归档:https://elasticsearch.cn/article/491
订阅:https://tinyletter.com/elastic-daily 收起阅读 »