环境:ES 6.8.10
os:Centos 7.8.2003 (Core)
1、创建新的索引(index)
PUT indexTest001
2、索引设置
ES 默认提供了好多索引配置选项,参考https://www.elastic.co/guide/en/elasticsearch/reference/5.6/index-modules.html
修改索引设置参考:https://blog.csdn.net/qq_15958689/article/details/79524291
3、创建mapping
先看下刚刚创建的索引的mapping:
GET indextest001/_mapping
由上图显示,新建的索引中,mapping是一个空集,我们要创建这个index的mapping
```xml POST indextest001/product/_mapping?pretty {"product":{"properties":{"title":{"type":"text","store":"true"},"description":{"type":"text","index":"false"},"price":{"type":"double"},"onSale":{"type":"boolean"},"type":{"type":"integer"},"createDate":{"type":"date"}}}}
![在这里插入图片描述](https://img-blog.csdnimg.cn/1b62d3048241473eb6aa3b3a73059ed0.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA6KW_57Gzcw==,size_20,color_FFFFFF,t_70,g_se,x_16) 创建完再次查看 ![在这里插入图片描述](https://img-blog.csdnimg.cn/6b114c12f8da45e1bafe922ad1bebad9.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA6KW_57Gzcw==,size_20,color_FFFFFF,t_70,g_se,x_16) 4、插入数据 POST indextest001/product {undefined "title": "test title 001", "description": "es test 001 ", "price": 1.6, "onSale": "true", "type": 2, "createDate": "2021-01-08" } 然后查询一下所有数据,默认为match_all GET indextest001/product/ [参考文章](https://blog.csdn.net/qq_15958689/article/details/79524291)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)