# Possible to define filters outside of searchprovider config using search ui?

**URL:** <https://discuss.elastic.co/t/possible-to-define-filters-outside-of-searchprovider-config-using-search-ui/325113>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [February 9, 2023, 8:54am UTC](https://discuss.elastic.co/t/possible-to-define-filters-outside-of-searchprovider-config-using-search-ui/325113 "2023-02-09T08:54:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![samuel-m](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@samuel-m](https://discuss.elastic.co/u/samuel-m)\
**Post date:** [February 9, 2023, 8:54am UTC](https://discuss.elastic.co/t/possible-to-define-filters-outside-of-searchprovider-config-using-search-ui/325113/1 "2023-02-09T08:54:17Z")

</div>

When using Search UI, is it possible to define search filters on other components than the `<SearchProvider>`?

This is the config for our SearchProvider:

```auto
const config: SearchDriverOptions = {
    alwaysSearchOnInitialLoad: false,
    apiConnector: SearchConnector(),
    hasA11yNotifications: true,
    autocompleteQuery: {
      results: {
        resultsPerPage: 8,
        result_fields: {
          search_title: { raw: {} },
          page_category: { raw: {} },
          url_path: { raw: {} },
        },
        search_fields: {
          search_title: { weight: 9 },
          meta_description: { weight: 7 },
          headings: { weight: 5 },
          body_content: { weight: 3 },
        },

        filters: [{ field: 'node_locale', values: [node_locale], type: 'all' }],
      },
    },
    searchQuery: {
      resultsPerPage: 24,
      result_fields: {
        search_title: { raw: {} },
        page_category: { raw: {} },
        url_path: { raw: {} },
        page_image: { raw: {} },
      },
      search_fields: {
        search_title: { weight: 9 },
        meta_description: { weight: 7 },
        headings: { weight: 5 },
        body_content: { weight: 3 },
      },
      filters: [{ field: 'node_locale', values: [node_locale], type: 'all' }],
      disjunctiveFacets: ['page_category'],
      facets: {
        page_category: {
          type: 'value',
          size: 100,
        },
      },
    },
  };
return config;

```

As you can see we filter results on locale, so the swedish part of the site doesn't return english search results and vice versa.

Since the `<SearchProvider>` needs to wrap our entire app, and since the `node_locale` is not available for us on that level of the app, it's not working to filter our search results by locale.

Is it possible to append the filter from further down the component tree? Such as from the `<Results>` and/or `<SearchBox>` components?

Bonus question: Why is `?size=n_20_n` appended to our URLs even if we do not search?

[https://dl.dropboxusercontent.com/s/p487lzyly4y5l33/elastic.mp4?dl=0](https://dl.dropboxusercontent.com/s/p487lzyly4y5l33/elastic.mp4?dl=0)

Best regards, Samuel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 9, 2023, 8:55am UTC](https://discuss.elastic.co/t/possible-to-define-filters-outside-of-searchprovider-config-using-search-ui/325113/2 "2023-03-09T08:55:00Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
