exclude items with newsletter or rss labels in library

This commit is contained in:
Hongbo Wu
2023-07-17 17:06:39 +08:00
parent b3dcf0ee46
commit be1e8169ba

View File

@ -149,30 +149,37 @@ const appendInFilter = (builder: ESBuilder, filter: InFilter): ESBuilder => {
},
})
case InFilter.LIBRARY:
return builder.query('nested', {
path: 'labels',
query: {
bool: {
should: [
{
return builder.query('bool', {
should: [
{
nested: {
path: 'labels',
query: {
term: {
'labels.name': 'library',
},
},
{
bool: {
must_not: {
terms: {
'labels.name': ['newsletter', 'rss'],
},
},
{
bool: {
must_not: [
{
nested: {
path: 'labels',
query: {
terms: {
'labels.name': ['newsletter', 'rss'],
},
},
},
should: [],
},
},
],
minimum_should_match: 1,
],
should: [],
},
},
},
],
minimum_should_match: 1,
})
case InFilter.SUBSCRIPTION:
return builder