我的映射如下:
{
"abc_history": {
"mappings": {
"abc-data-type": {
"sData.Name": {
"full_name": "sData.Name",
"mapping": {
"Name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
}
我正在尝试对sData.Name
执行通配符搜索,并使用以下查询:
{
"from": 0,
"size": 20,
"query": {
"bool": {
"must":[
{"range": {"requestDate": { "gte": "2019-10-01T08:00:00.000Z" }}},
{
"wildcard": {
"sData.Name": "*Scream*"
}
}
]
}
},
"sort": [
{ "requestDate": {"order": "desc"}}
]
}
以上查询返回空响应。我应该如何修改查询,以便可以在wildcard search
]上执行sData.Name
http://{serverhost}:{port}/abc_history/_search
的响应如下:
{ "took": 181, "timed_out": false, "_shards": { "total": 3, "successful": 3, "skipped": 0, "failed": 0 }, "hits": { "total": 1, "max_score": null, "hits": [ { "_index": "abc_history", "_type": "abc-data-type", "_id": "5e29cbb7965809fe6cb22a7b", "_score": null, "_source": { "sData": [ { "status": "ASSIGNED", "Name": "CloudView abcmission Automation Support", startDate : "2020-01-26T20:12:57.091Z" }, { "status": "RESOLVED", "Name": "DSE - Tools Engineering", startDate : "2020-01-27T20:12:57.091Z" }, { "status": "CLOSED", "Name": "abcmission Orchestration", startDate : "2020-01-29T20:12:57.091Z" }, { "status": "ASSIGNED", "Name": "CloudView abcmission Automation Support", startDate : "2020-01-29T20:19:29.687Z" } ] }, "sort": [ 1579797431366 ] } ] } }
我主要关注查询
sData.Name
。我只想在最后一个数组元素中执行搜索。因此,在我的情况下,我只想搜索sData[3].Name
,换句话说,应该只在DSE
内搜索关键字"Name": "CloudView abcmission Automation Support"
我的映射如下:{“ abc_history”:{“映射”:{“ abc-data-type”:{“ sData.Name”:{“ full_name”:“ sData.Name”,...
我尝试通过您的输入创建索引。尝试使用