spark、es、java精确匹配
来源:互联网 发布:查看数据库命令 编辑:程序博客网 时间:2024/06/08 08:43
1、新建一个索引waybill
curl -XPUT http://10.118.58.67:9200/waybill
2、为索引添加type及type的mapping,注意:对于需要完全精确匹配的字段需要设置为string类型、index方式为not_analyzed。字段类型创建后无法修改。
curl -XPUT http://10.116.50.223:9200/waybill/details/_mapping?pretty-d '
{"details":{"properties":
{"backnewway":{"type":"string","index":"not_analyzed"},
"barscantm":{"type":"long"},
"calhour":{"type":"long"},"caltime":{"type":"long"},
"collectondelivery":{"type":"string","index":"not_analyzed"},
"consigneddt":{"type":"long"},"consignedtm":{"type":"long"},
"custno":{"type":"string","index":"not_analyzed"},
"describle":{"type":"string","index":"not_analyzed"},
"destname":{"type":"string","index":"not_analyzed"},
"destprovince":{"type":"string","index":"not_analyzed"},
"erpno":{"type":"string","index":"not_analyzed"},
"group_code":{"type":"string","index":"not_analyzed"},
"md5str":{"type":"string"},"meterageweightqty":{"type":"float"},
"opcode":{"type":"string","index":"not_analyzed"},
"paymenttype":{"type":"string","index":"not_analyzed"},
"realweightqty":{"type":"float"},
"returntm":{"type":"long"},"signbacktm":{"type":"long"},
"signbackwaybill":{"type":"string","index":"not_analyzed"},
"signintm":{"type":"long"},"signstate":{"type":"string","index":"not_analyzed"},
"sourcename":{"type":"string","index":"not_analyzed"},
"sourcewaybill":{"type":"string","index":"not_analyzed"},
"stayreason":{"type":"string","index":"not_analyzed"},
"staytype":{"type":"string","index":"not_analyzed"},
"staywhycode":{"type":"string","index":"not_analyzed"},"subsize":{"type":"long"},
"switchcom":{"type":"string","index":"not_analyzed"},"switchtm":{"type":"long"},
"switchway":{"type":"string","index":"not_analyzed"},"topic":{"type":"string","index":"not_analyzed"},
"waybill":{"type":"string","index":"not_analyzed"}}}}'
3、设置默认分页大小
curl -XPUT http://10.118.58.67:9200/waybill/_settings?pretty -d '
{"max_result_window":500000}'
4、按照设置的mapping写df数据
resDf.write.mode(SaveMode.Append)
.format("org.elasticsearch.spark.sql")
.save("waybill/details")
4、java读取es数据
配置settings,添加es master节点。
QueryBuilder、BoolQueryBuilder、addSort、setSize、execute
- spark、es、java精确匹配
- java操作es的多条件组合精确查询BoolQuery
- Spark-kafka-ES (JAVA)一套流程
- 中文搜索的精确匹配
- php精确匹配中文
- CCombBox精确匹配查找
- grep 精确匹配
- php精确匹配中文
- vim精确匹配
- contains 精确匹配
- grep精确匹配
- spark 读取 es 的es查询语法
- 字符串多模式精确匹配
- elasticsearch 查询内容精确匹配
- js 正则表达式精确匹配
- elasticsearch查询内容精确匹配
- spark连接es的问题java.lang.ClassNotFoundException:org.elasticsearch.client.transport.NoNodeAvailableExcep
- 使用ES-Hadoop插件结合spark向es插入数据
- java中根据输入的数字输出空心菱形和实心菱形
- 08 uboot上增加自己的命令
- 原生JavaScript实现Ajax(二):同步,异步,GET,POST
- spring mvc中得/和/*的区别
- 凸包
- spark、es、java精确匹配
- Java7并发编程指南——第一章:线程管理
- Java 实例
- Problem B: 平面上的点——Point类 (II)
- hibernate-关系映射-多对多(单向)-11
- Jmeter参数化的4种方法
- Linux基础-7(nginx)
- 第八届蓝桥杯国赛Java b组 第一题
- 贝叶斯网络