Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]match_all query filters applied despite courier:ignoreFilterIfFieldNotInIndex setting enabled #5423

Closed
ananzh opened this issue Nov 3, 2023 · 2 comments · Fixed by #5577
Labels
bug Something isn't working good first issue Good for newcomers v2.12.0

Comments

@ananzh
Copy link
Member

ananzh commented Nov 3, 2023

Describe the bug
The match_all query filter is applied and included in the OpenSearch request when courier:ignoreFilterIfFieldNotInIndex is enabled. This setting is used to skip filters that apply to fields that don’t exist in the index for a visualization. However, we see filter applied even if the field the filter applies to does not exist in the index pattern of the visualization, which contradicts the expected behavior as per the setting's definition.

Screenshot 2023-11-03 at 10 56 38
bug-rep.mov

To Reproduce

  • Navigate to Stack Management > Advanced Settings > courier:ignoreFilterIfFieldNotInIndex.
  • Enable the setting courier:ignoreFilterIfFieldNotInIndex and save the changes.
  • Create a visualization of type DataTable and choose an index pattern.
  • In Buckets, split rows, choose aggregation as "Terms", select a field of type string, and click Update.
  • Add a normal filter (match_all query) that targets a non-existent field in the chosen index pattern.
  • Click Inspect -> View: Requests -> Click request: Here the custom query DSL that we created is still sent in the request.

Expected behavior
with courier:ignoreFilterIfFieldNotInIndex Enabled
Filters that target fields not present in the index pattern should be skipped, and not included in the request. Both prefix query and match_all query should not send the request for non-existent fields.

OpenSearch Version
any

Dashboards Version
any

Plugins

na

@ananzh ananzh added bug Something isn't working untriaged labels Nov 3, 2023
@ananzh
Copy link
Member Author

ananzh commented Nov 3, 2023

#5581

@anand3493
Copy link

anand3493 commented Nov 6, 2023

@ananzh I believe you misunderstood my issue raised in the bug #5581

Re-explaining:
courier:ignoreFilterIfFieldNotInIndex is enabled now

Irrespective of the type of filter (either custom query DSL or normal filter), the filter should be applied if the field is present in the chosen index.

The filter should not be applied only when the field is not present on the index pattern

My issue is I have enabled the ignoreFilterIfFieldNotInIndex option and I create a visualization for a index pattern and I create a custom query DSL filter for a field which is present on the chosen index.
Expected Outcome: Fitler should be applied.
Current misbehavior: Filter is not sent in the request.

In the bug-rep video, first scenario where you try the prefix query dsl filter - that is the actual issue. I expect the filter should be applied there. However it is not sent in the request at all. You considered multiple indices where only one index has that prefix field.
Just think that you have enabled the ignoreFilterIfFieldNotInIndex option.
let's say we have index patterns: logstash*, metrics*, events*.
Now I create a visualization on top of logstash* index pattern, which has documents with field "user-agent".
So now when I try to create my custom query DSL filter with some prefix value on top logstash*, I expect the filter to be applied. However it is not sent.

@ananzh ananzh added good first issue Good for newcomers and removed untriaged labels Nov 7, 2023
kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this issue Dec 6, 2023
When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
opensearch-project#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>
kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this issue Dec 6, 2023
When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
opensearch-project#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>
@kavilla kavilla linked a pull request Dec 6, 2023 that will close this issue
7 tasks
kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this issue Dec 6, 2023
When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
opensearch-project#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>
@ananzh ananzh added the v2.12.0 label Dec 6, 2023
kavilla added a commit that referenced this issue Dec 7, 2023
…#5577)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
opensearch-trigger-bot bot pushed a commit that referenced this issue Dec 7, 2023
…#5577)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
(cherry picked from commit 805400d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
opensearch-trigger-bot bot pushed a commit that referenced this issue Dec 7, 2023
…#5577)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
(cherry picked from commit 805400d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
opensearch-trigger-bot bot pushed a commit that referenced this issue Dec 7, 2023
…#5577)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
(cherry picked from commit 805400d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
Alankarsharma pushed a commit to Alankarsharma/OpenSearch-Dashboards that referenced this issue Dec 8, 2023
…opensearch-project#5577)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
opensearch-project#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Alankarsharma <[email protected]>
ananzh pushed a commit that referenced this issue Dec 12, 2023
…#5577) (#5585)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
(cherry picked from commit 805400d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ananzh pushed a commit that referenced this issue Dec 12, 2023
…#5577) (#5583)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
(cherry picked from commit 805400d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this issue Dec 13, 2023
…#5577)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
(cherry picked from commit 805400d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
ananzh pushed a commit that referenced this issue Dec 13, 2023
…#5577) (#5584)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
(cherry picked from commit 805400d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ananzh pushed a commit that referenced this issue Dec 15, 2023
When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

Issue could be closed:
#5423

---------

Signed-off-by: Alankarsharma <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kawika Avilla <[email protected]>
Co-authored-by: Qingyang(Abby) Hu <[email protected]>
opensearch-trigger-bot bot added a commit that referenced this issue Dec 15, 2023
When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

Issue could be closed:
#5423

---------

Signed-off-by: Alankarsharma <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kawika Avilla <[email protected]>
Co-authored-by: Qingyang(Abby) Hu <[email protected]>
(cherry picked from commit d8cbc17)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
abbyhu2000 added a commit that referenced this issue Dec 19, 2023
When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

Issue could be closed:
#5423

---------







(cherry picked from commit d8cbc17)

Signed-off-by: Alankarsharma <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Kawika Avilla <[email protected]>
Co-authored-by: Qingyang(Abby) Hu <[email protected]>
zhyuanqi pushed a commit to zhyuanqi/OpenSearch-Dashboards that referenced this issue Jan 8, 2024
…opensearch-project#5577)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
opensearch-project#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Yuanqi(Ella) Zhu <[email protected]>
zhyuanqi pushed a commit to zhyuanqi/OpenSearch-Dashboards that referenced this issue Jan 8, 2024
…opensearch-project#5577)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
opensearch-project#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
zhyuanqi pushed a commit to zhyuanqi/OpenSearch-Dashboards that referenced this issue Jan 8, 2024
…opensearch-project#5577)

* [BUG][Data] Support for custom filters with heterogeneous data fields

When enabling the advanced setting `courier:ignoreFilterIfFieldNotInIndex`
Custom OpenSearch Query DSL filters could technically be applied to index
patterns that map to indices that are not exactly the same. Since the
custom query filter is a user input then users can really type anything
that they need. Or any field that they know is present but we do not know
for sure.

Therefore, we can check if the id which is the index pattern title to check
if we should apply the filter or not.

Issue resolved:
https://github.com/opensearch-project/dashboards-visualizations/issues/281

I believe issue:
opensearch-project#5423

Should closed as that is expected functionality.

Signed-off-by: Kawika Avilla <[email protected]>

* [Cleanup] utilize the same helper function

Originally when implementing the fix the historical comment caused concern about
potential breaking changes.

But after discussion, we decided it is more clear to consolidate the helper functions.

Signed-off-by: Kawika Avilla <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers v2.12.0
Projects
None yet
2 participants