query: {
bool: {
must: [
{
query_string: {
fields: [
"seq",
"alert.signature.keyword",
],
query: `*${this.searchKeyword}*`,
}
},
{
range: {
"@timestamp": {
gt: new Date(this.stdt).toISOString(),
lt: new Date(this.eddt).toISOString(),
},
},
}
],
},
},
...
// 빈칸인 경우에는 query_string 문을 아예 빼서 전체가 검색되도록. (날짜조건만 남김)
if (!this.searchKeyword) {
option.data.query.bool.must = [option.data.query.bool.must[1]];
}
query: {
bool: {
must: [
{
match: {
"seq": {
query: `${this.searchKeyword}`
}
}
},
{
match: {
"alert.signature.keyword": {
query: `${this.searchKeyword}`
}
}
}
],
filter:[
{
range: {
"@timestamp": {
gt: new Date(this.stdt).toISOString(),
lt: new Date(this.eddt).toISOString(),
},
},
},
]
},
},
...
// 빈칸인 경우에는 query_string 문을 아예 빼서 전체가 검색되도록. (날짜조건만 남김)
if (!this.searchKeyword) {
option.data.query.bool.must = [option.data.query.bool.filter[0]];
}
### 검색 불가 쿼리 1번
must: [
{
wildcard:{
"seq": {
value : `*${this.searchKeyword}*`
}
}
},
{
wildcard:{
"alert.signature.keyword": {
value : `*${this.searchKeyword}*`
}
}
}
],
### 검색 불가 쿼리 2번
must: [
{
query:{
wildcard:{
"seq": `*${this.searchKeyword}*`
}
}
},
{
query:{
wildcard:{
"alert.signature": `*${this.searchKeyword}*`
}
}
}
],
match
쿼리 내부에서 wildcard
쿼리를 사용하는 구문은 적절하지 않습니다.
대신에, wildcard
쿼리는 query_string
쿼리 내에서 사용됩니다.