随记:cerebro命令查询界面命令

bundleskuindex/_search

查询文档中字段lastModified值范围在2022-06-01和2022-06-05之间
{
"query":{
"range":{
"lastModified":{
"gte" : "2022-06-01",
"lt" : "2022-06-05"
}
}
}
}

查询文档中字段code值为CE0001990或GY0016517
{
"query":{
"terms":{
"code":["CE0001990","GY0016517"]
}
}
}

文档中是否包含了字段code
{
"query":{
"exists":{
"field":"code"
}
}
}

查询文档中字段code值包含Y001651
{
"query":{
"wildcard":{
"code":"*Y001651*"
}
}
}

分页
{
"query":{
"term":{
"isOffShelf":true
}
},
"from":2,
"size":2
}

排序
{
"query":{
"term":{
"isOffShelf":true
}
},
"sort": [
{
"lastModified": "desc"
}
]
}


嵌套排序,嵌套字段必须指定类型nested
{
"sort": [
{
"newProductPlatformInfos.audited": {
"nested_path": "newProductPlatformInfos",
"order":"asc",
"nested_filter":{
"term":{
"newProductPlatformInfos.platformType":0
}
}
}
}
]
}

 

查询title中必须有毛,绒,球三个字
{
"query":{
"match":{
"title":{
"query":"毛绒球毛毛",
"operator":"and"
}
}
}
}

查询title中只要有毛,绒,球其中一个字
{
"query":{
"match":{
"title":"毛绒球毛毛"
}
}
}

组合查询
{
"query":{
"bool":{
"must":{
"term":{
"isOffShelf":true
}
},
"must":{
"range":{
"weight":{
"gte":0.3,
"lt":0.4
}
}
},
"should":[
{
"terms":{
"editStatus":[3,4,5]
}
},
{
"bool":{
"must":[
{
"term":{
"attributes":1
}
}
]
}
}
]
}
}
}


新增数据
testindex/bundlesku/1
{
"code":"CE0001992",
"newProductPlatformInfos":[
{
"audited":"2022-05-02",
"platformType":0
},
{
"audited":"2022-01-02",
"platformType":1
}
]
}

 

插入新字段
testindex/_mapping/testbundlesku
{
"properties": {
"platformSkuList":{
"type": "nested",
"properties": {
"id": {
"type": "keyword"
},
"created": {
"type": "date"
}
}
}
}
}

 

删除文档
testindex/bundlesku/11e0d46f-828b-4418-bec4-ed527055c764

posted @ 2022-06-07 09:56  元点  阅读(348)  评论(0编辑  收藏  举报