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

Facet filterType="none" doesn't translate to a must_not filter in Elasticsearch Connector query #783

Open
rodeinator opened this issue Jun 29, 2022 · 6 comments
Labels
bug Something isn't working elasticsearch-connector enhancement pinned tracking Adding issue to project board

Comments

@rodeinator
Copy link

We tested the Facet component with filterType="none". But it doesn't translate to a must_not filter in Elasticsearch query.

<Facet
  field="comics"
  label="Comics"
  filterType={"none"}
  view={MultiCheckboxFacet}
/>

Resulting request query:

"filter" => [
  %{"bool" => %{"must" => [%{"term" => %{"comics" => "Batman"}}]}}]

When we set a filter in config.filters the query uses must_not as expected

filters: [
      { field: "comics", values: ["Batman"], type: "none" }
]

Resulting request query:

"filter" => [
   %{"bool" => %{"must_not" => [%{"term" => %{"comics" => "Batman"}}]}}
]
@rodeinator rodeinator added the bug Something isn't working label Jun 29, 2022
@joemcelroy
Copy link
Member

Thanks so much for the bug report. will get back to you.

@botelastic
Copy link

botelastic bot commented Aug 28, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Is this issue still important to you? If so, please leave a comment and let us know. As always, thank you for your contributions.

@botelastic botelastic bot added the wontfix This will not be worked on label Aug 28, 2022
@JasonStoltz JasonStoltz added pinned and removed wontfix This will not be worked on labels Aug 29, 2022
@cingram16
Copy link

+1 in need of this capability.

Any plans to work this issue?

@fa11enangel
Copy link

fa11enangel commented Aug 31, 2022

An other solution would be to build up a second data structure, where all not selected/saved/set data fields would be saved and query these for existance, if something should not have it.

An example for movies and genres would be: The Matrix

  • genre: action
  • not_genre: drama, horror, comedy, western, romance, comic, anime, ....

Something like "all comedies which are not anime":

filters: [
        {
          field: 'genre',
          type: 'all',
          values: ['comedy'],
        },
        {
          field: 'not_genre',
          type: 'all',
          values: ['anime'],
        },
],

@RobbyUitbeijerse
Copy link

We ran into a similar issue where we tried to pass 'none' as a filter in the provider config for a specific page, but type: 'none' gives us no results at all, while type: 'all' returns the exact item we want to exclude (so that at least confirms that the data is good)

here is a snippet:

      filters: [
        {
          field: 'address.keyword',
          type: 'none',
          values: [contractAddress],
        },
      ],

Could it be that that the transformation in the connector package doesn't actually build up a query that is usable for elastic? I don't have the thorough experience with Elastic yet to confirm it based on what I'm seeing here:

https://github.com/elastic/search-ui/blob/master/packages/search-ui-elasticsearch-connector/src/handlers/search/Configuration.ts

@filipefborba
Copy link

Can confirm that adding a filter with type "any" (should) or "none" (must_not) doesn't work. It always defaults to "all" (filter).
This is definitely a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working elasticsearch-connector enhancement pinned tracking Adding issue to project board
Projects
None yet
Development

No branches or pull requests

9 participants