[8.6] [Lens] fix lucene object query bug (#146846) (#146914)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Lens] fix lucene object query bug
(#146846)](https://github.com/elastic/kibana/pull/146846)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Andrew
Tate","email":"andrew.tate@elastic.co"},"sourceCommit":{"committedDate":"2022-12-02T19:05:53Z","message":"[Lens]
fix lucene object query bug (#146846)\n\n## Summary\r\n\r\nfix
https://github.com/elastic/kibana/issues/146819","sha":"3c351fffc184d23eafd98a0c61d6c3e28840a59d","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:prev-minor","v8.7.0"],"number":146846,"url":"https://github.com/elastic/kibana/pull/146846","mergeCommit":{"message":"[Lens]
fix lucene object query bug (#146846)\n\n## Summary\r\n\r\nfix
https://github.com/elastic/kibana/issues/146819","sha":"3c351fffc184d23eafd98a0c61d6c3e28840a59d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146846","number":146846,"mergeCommit":{"message":"[Lens]
fix lucene object query bug (#146846)\n\n## Summary\r\n\r\nfix
https://github.com/elastic/kibana/issues/146819","sha":"3c351fffc184d23eafd98a0c61d6c3e28840a59d"}}]}]
BACKPORT-->

Co-authored-by: Andrew Tate <andrew.tate@elastic.co>
This commit is contained in:
Kibana Machine 2022-12-02 15:11:45 -05:00 committed by GitHub
parent a924f45845
commit 399d39e60e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -176,7 +176,9 @@ export function combineQueryAndFilters(
};
const allQueries = Array.isArray(query) ? query : query && isOfQueryType(query) ? [query] : [];
const nonEmptyQueries = allQueries.filter((q) => Boolean(q.query.trim()));
const nonEmptyQueries = allQueries.filter((q) =>
Boolean(typeof q.query === 'string' ? q.query.trim() : q.query)
);
[queries.lucene, queries.kuery] = partition(nonEmptyQueries, (q) => q.language === 'lucene');