fix searching for multiple labels (#444)
This commit is contained in:
@ -128,21 +128,17 @@ const appendIncludeLabelFilter = (
|
|||||||
body: SearchBody,
|
body: SearchBody,
|
||||||
filters: LabelFilter[]
|
filters: LabelFilter[]
|
||||||
): void => {
|
): void => {
|
||||||
body.query.bool.filter.push({
|
filters.forEach((filter) => {
|
||||||
nested: {
|
body.query.bool.filter.push({
|
||||||
path: 'labels',
|
nested: {
|
||||||
query: {
|
path: 'labels',
|
||||||
bool: {
|
query: {
|
||||||
filter: filters.map((filter) => {
|
terms: {
|
||||||
return {
|
'labels.name': filter.labels,
|
||||||
terms: {
|
},
|
||||||
'labels.name': filter.labels,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,12 +32,8 @@ export interface SearchBody {
|
|||||||
nested: {
|
nested: {
|
||||||
path: 'labels'
|
path: 'labels'
|
||||||
query: {
|
query: {
|
||||||
bool: {
|
terms: {
|
||||||
filter: {
|
'labels.name': string[]
|
||||||
terms: {
|
|
||||||
'labels.name': string[]
|
|
||||||
}
|
|
||||||
}[]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user