首页 > 编程知识 正文

elasticsearch查询语句,索引生命周期

时间:2023-05-06 04:20:05 阅读:132709 作者:1522

目录创建索引创建映射添加删除

索引PUT test_index/

创建一个名为test_index的索引

mappingputtest _ index/te st01/_ mapping { ' te st01 ' : } ' properties ' : { ' id ' : { ' type ' : ' text type是test01的映射,属性中字段的数据类型

text keyword都是文本类型,text支持分词,可以设置分词。 另一方面,keyword不支持分词,用于过滤、排序和聚合。加粗样式

参见3https://blog.csdn.net/sun jinjuan/article/details/81986164

通过post上传数据

post test_index/teST01 { ' id ' : ' aa ',' title':'bb'}根据post请求索引为test _ index,类型为te st01

这是在增加一个数据后返回的值。 因为在上载数据时没有指定Document,所以这里会生成随机id

让我查一下。查询单条数据

gettest _ index/te st01/JVs new0bzpthbqanuwcwget索引/类型/文档查询所有数据

gettest_index/teST01/_search { ' query ' : { ' match _ all ' : { } }在gettest _ index/te st01/_ search中

gettest _ index/te st01/_ search { ' query ' : } ' match ' 3360 { ' id ' : ' aa ' },' _ source ' : [ '

删除DELETE索引名称

还有很多复杂的查询语句可以查看官方文档

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。