fix searching for multiple labels (#444)

This commit is contained in:
Hongbo Wu
2022-04-19 12:13:47 +08:00
committed by GitHub
parent 1117a0c575
commit d7a2659fc4
2 changed files with 11 additions and 19 deletions

View File

@ -128,21 +128,17 @@ const appendIncludeLabelFilter = (
body: SearchBody,
filters: LabelFilter[]
): void => {
body.query.bool.filter.push({
nested: {
path: 'labels',
query: {
bool: {
filter: filters.map((filter) => {
return {
terms: {
'labels.name': filter.labels,
},
}
}),
filters.forEach((filter) => {
body.query.bool.filter.push({
nested: {
path: 'labels',
query: {
terms: {
'labels.name': filter.labels,
},
},
},
},
})
})
}

View File

@ -32,12 +32,8 @@ export interface SearchBody {
nested: {
path: 'labels'
query: {
bool: {
filter: {
terms: {
'labels.name': string[]
}
}[]
terms: {
'labels.name': string[]
}
}
}