ES建立索引步骤, 1,index 2.mapping 3,别名

1.建立索引
PUT /index_trans_detail

2.建立mapping
POST /index_trans_detail/type_trans_detail/_mapping
{
"type_trans_detail": {
"properties": {
"id": {
"type": "long"
},
"entId": {
"type": "long"
},
"orgId": {
"type": "long"
},
"seqno": {
"type": "text",
"fielddata": true
},
"transDate": {
"type": "date",
"format": "yyyy-MM-dd"
},
"postTatus": {
"type": "integer"
},
"ioFlag": {
"type": "integer"
},
"depotId": {
"type": "long"
},
"depotCode": {
"type": "keyword"
},
"depotName": {
"type": "text"
},
"depotClassId": {
"type": "long"
},
"depotClassCode": {
"type": "keyword"
},
"depotClassName": {
"type": "text"
},
"orgOrgId": {
"type": "long"
},
"orgOrgCode": {
"type": "keyword"
},
"orgOrgName": {
"type": "text"
},
"orgOrgClassId": {
"type": "long"
},
"orgOrgClassCode": {
"type": "keyword"
},
"orgOrgClassName": {
"type": "text"
},
"balOrgId": {
"type": "long"
},
"balOrgCode": {
"type": "keyword"
},
"balOrgName": {
"type": "text"
},
"transOrgId": {
"type": "long"
},
"transOrgCode": {
"type": "keyword"
},
"transOrgName": {
"type": "text"
},
"transOrgClassId": {
"type": "long"
},
"transOrgClassCode": {
"type": "keyword"
},
"transOrgClassName": {
"type": "text"
},
"transBalOrgId": {
"type": "long"
},
"transBalOrgCode": {
"type": "keyword"
},
"transBalOrgName": {
"type": "text"
},
"transTypeId": {
"type": "long"
},
"transType": {
"type": "keyword"
},
"transName": {
"type": "text"
},
"dutyBillId": {
"type": "long"
},
"dutyBillType": {
"type": "integer"
},
"dutyBillNo": {
"type": "text",
"fielddata": true
},
"sourceId": {
"type": "long"
},
"sourceType": {
"type": "integer"
},
"sourceNo": {
"type": "keyword"
},
"billStatus": {
"type": "integer"
},
"headRemark": {
"type": "text"
},
"isAllowDel": {
"type": "integer"
},
"useOrgId": {
"type": "long"
},
"headIoQty": {
"type": "double"
},
"headIoAmt": {
"type": "double"
},
"headIoCostAmt": {
"type": "double"
},
"periodNo": {
"type": "text"
},
"externalBillNo": {
"type": "text"
},
"externalSysType": {
"type": "integer"
},
"useDepId": {
"type": "long"
},
"useDepCode": {
"type": "keyword"
},
"useDepName": {
"type": "text"
},
"usePurpose": {
"type": "integer"
},
"transId": {
"type": "long"
},
"goodsId": {
"type": "long"
},
"goodsCode": {
"type": "keyword"
},
"goodsName": {
"type": "text"
},
"goodsClassId": {
"type": "long"
},
"goodsClassCode": {
"type": "keyword"
},
"goodsClassName": {
"type": "text"
},
"goodsSpec": {
"type": "keyword"
},
"goodsOrigin": {
"type": "text"
},
"postFlag": {
"type": "integer"
},
"goodsWeight": {
"type": "double"
},
"ioQty": {
"type": "double"
},
"ioPrice": {
"type": "double"
},
"ioAmt": {
"type": "double"
},
"unitId": {
"type": "long"
},
"unitName": {
"type": "text"
},
"unitRate": {
"type": "double"
},
"iocostPrice": {
"type": "double"
},
"ioCostAmt": {
"type": "long"
},
"feeAmt": {
"type": "long"
},
"lotId": {
"type": "long"
},
"dutyBillDetailId": {
"type": "long"
},
"sourceDetailId": {
"type": "long"
},
"dutyOrgId": {
"type": "long"
},
"postUserId": {
"type": "long"
},
"postDateTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"postReturnId": {
"type": "long"
},
"errMsg": {
"type": "text"
},
"firstPostDatetime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"balanceFlag": {
"type": "integer"
},
"remark": {
"type": "text"
},
"baseQty": {
"type": "double"
},
"baseUnitId": {
"type": "long"
},
"baseUnitName": {
"type": "text"
},
"baseUnitPrice": {
"type": "double"
},
"createType": {
"type": "integer"
},
"createHeadId": {
"type": "long"
},
"invUnitId": {
"type": "long"
},
"invUnitCode": {
"type": "keyword"
},
"invUnitName": {
"type": "text"
},
"invUnitRate": {
"type": "double"
},
"invQty": {
"type": "double"
},
"invCostPrice": {
"type": "double"
},
"discountRate": {
"type": "double"
},
"discountTaxRate": {
"type": "double"
},
"taxRate": {
"type": "double"
},
"taxAmt": {
"type": "double"
},
"ioBillStatus": {
"type": "integer"
},
"ioBillTime": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"ioBillQty": {
"type": "double"
},
"taxType": {
"type": "integer"
},
"isStoBackPrice": {
"type": "integer"
},
"stoCostPrice": {
"type": "double"
},
"stoCostAmt": {
"type": "double"
},
"version": {
"type": "integer"
},
"deleted": {
"type": "long"
},
"creatorCode": {
"type": "keyword"
},
"creatorName": {
"type": "text",
"fielddata": true
},
"createdAt": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"creatorOrgCode": {
"type": "keyword",
"index": false
},
"modifierCode": {
"type": "keyword",
"index": false
},
"modifierName": {
"type": "text"
},
"lastModifiedAt": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"modifierOrgCode": {
"type": "keyword",
"index": false
},
"invTransHeadId": {
"type": "long"
},
"handledOrgCode": {
"type": "keyword"
},
"handledOrgName": {
"type": "text"
},
"createdAtTimestamp": {
"type": "date",
"format": "epoch_millis"
},
"transDateTimestamp": {
"type": "date",
"format": "epoch_millis"
},
"lastModifiedTimestamp": {
"type": "date",
"format": "epoch_millis"
},
"postDateTimeTimestamp": {
"type": "date",
"format": "epoch_millis"
},
"ioBillTimeTimestamp": {
"type": "date",
"format": "epoch_millis"
},
"firstPostDatetimeTimestamp": {
"type": "date",
"format": "epoch_millis"
}
}
}
}

3.建立别名
PUT /index_trans_detail/_alias/index_trans_detail_alias

原文地址:https://www.cnblogs.com/zeenzhou/p/11588631.html

时间: 2024-08-30 16:50:22

ES建立索引步骤, 1,index 2.mapping 3,别名的相关文章

elasticsearch index 之 Mapping

Lucene索引的一个特点就filed,索引以field组合.这一特点为索引和搜索提供了很大的灵活性.elasticsearch则在Lucene的基础上更近一步,它可以是 no scheme.实现这一功能的秘密就Mapping.Mapping是对索引各个字段的一种预设,包括索引与分词方式,是否存储等,数据根据字段名在Mapping中找到对应的配置,建立索引.这里将对Mapping的实现结构简单分析,Mapping的放置.更新.应用会在后面的索引fenx中进行说明. 首先看一下Mapping的实现

Spark2.2+ES6.4.2(三十二):ES API之ndex的create(创建index时设置setting,并创建index后根据avro模板动态设置index的mapping)/update/delete/open/close

要想通过ES API对es的操作,必须获取到TransportClient对象,让后根据TransportClient获取到IndicesAdminClient对象后,方可以根据IndicesAdminClient对象提供的方法对ES的index进行操作:create index,update index(update index settings,update index mapping),delete index,open index,close index. 准备工作(创建Transpor

mongodb 建立索引提示异常:WiredTigerIndex::insert: key too large to index, failing 1483

{ "ok" : 0.0, "errmsg" : "WiredTigerIndex::insert: key too large to index, failing 1483 { : \"山东隔断|山东隔断厂家|山东隔断价格|山东活动隔断|山东酒店活动隔断|烟台活动玻璃隔断|山东活动展板|山东隔??...\" }", "code" : 17280 } MongoDB will not create an i

FOREIGN KEY 外键约束; UNIQUE和PRIMARY KEY 主键约束、CREATE INDEX建立索引的使用

1)foreign key 是个约束,意思是说如果你给A字段设置了外键约束,以后你要往A字段插入数据,这个数据一定是要在foreign key 后面跟的那个字段中存在的值.这个的意义就是约束了数据的完整性,不会插入错误的数据. 修改添加t_topic外键约束: ALTER TABLE t_topic ADD CONSTRAINT fk_userTopics FOREIGN KEY (user_id) REFERENCES t_users(id) 删除表t_topic外键: ALTER TABLE

lucene 建立索引的过程

时间 2014-06-30 17:56:52 ? CSDN博客 原文 http://blog.csdn.net/caohaicheng/article/details/35992149 看lucene主页(http://lucene.apache.org/)上目前lucene已经到4.9.0版本了, 参考学习的书是按照2.1版本讲解的,写的代码例子是用的3.0.2版本的,版本 的不同导致有些方 法的 使用差异,但是大体还是相同的. 源代码用到的jar包(3.0.2版本)下载地址 参考资料: 1.

Oracle索引总结(五)- Oracle索引种类之表簇索引(cluster index)

表簇索引(cluster index) 对于表簇索引而言,必须使用表簇. 由于簇索引与索引表簇关联紧密,无法单独拿出来总结,因此一并进行总结. 1.1 表簇的定义 表簇是一组通过相同公共列(簇键),构成的表的集合. 如上图,右侧独立的两张表,employees员工表与departments部门表,通过簇键department_id列,构成了左侧的一个表簇(cluster). 当构成表簇后,一个单独的数据块会包含多个表的数据行信息. 1.2 表簇的分类 对于oracle数据库,主要支持两种表簇:索

ElasticSearch 用ik分词器建立索引(java API)

ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticsearch是用Java开发的,作为当前流行的企业级搜索引擎,用于云计算中,能够达到实时搜索,并且具有稳定,可靠,快速安装,使用方便等多种优点,得到大多数企业的青睐. ElasicSearch可以通过终端建立索引,但是本人在做项目的时候用终端建立的索引,然后使用Java API进行数据的插入,始终得不到分词,最终的解决办法就是通过Java API

elasticsearch建立索引操作的API

ElasticSearch-API-Index 索引创建API允许初始化一个索引.ElasticSearch对多重索引提供了支持,包括跨多个索引执行操作.每个索引在创建时可以让一个特定的设置项与其关联. 最简单的方式创建索引 curl -XPUT 'http://localhost:9200/twitter/' 在创建索引的时候指定分片和副本数量,参数格式采用YAML格式 curl -XPUT 'http://localhost:9200/twitter/' -d ' index:   numb

mysql建立索引

建立索引常用的规则如下: 1.表的主键.外键必须有索引: 2.数据量超过300的表应该有索引:3.经常与其他表进行连接的表,在连接字段上应该建立索引: 4.经常出现在Where子句中的字段,特别是大表的字段,应该建立索引:5.索引应该建在选择性高的字段上:6.索引应该建在小字段上,对于大的文本字段甚至超长字段,不要建索引:7.复合索引的建立需要进行仔细分析:尽量考虑用单字段索引代替: A.正确选择复合索引中的主列字段,一般是选择性较好的字段: B.复合索引的几个字段是否经常同时以AND方式出现在