Hello there,
I am using ElasticSearch and I want to make a query.
I have differents modules: ['a', 'b', 'c', 'd'].
where a and b have an extra value (companyId) I need to filter the text of all modules, but I need to filter the companyId just for a and b not for modules c and d.
This will look something like this:
SELECT * FROM my_table WHERE (modules in ('a', 'b') and companyId='myid') OR (modules in ('b', 'c'))
But I have this:
client.search({
index: INDEX,
type: TYPE,
body: {
query: {
bool: {
must: {
match: { text: 'mytext' },
},
filter: [
{ terms: { module: ['a', 'b', 'c', 'd'] } },
{ term: { companyId: 'myid' } },
]
}
}
}
});
Thanks a lot if you can help.