# Toogle index in search provider react search-ui

**URL:** <https://discuss.elastic.co/t/toogle-index-in-search-provider-react-search-ui/282838>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [August 30, 2021, 3:38pm UTC](https://discuss.elastic.co/t/toogle-index-in-search-provider-react-search-ui/282838 "2021-08-30T15:38:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![artcups](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/artcups/32/93899_2.png) [@artcups](https://discuss.elastic.co/u/artcups)\
**Post date:** [August 30, 2021, 3:38pm UTC](https://discuss.elastic.co/t/toogle-index-in-search-provider-react-search-ui/282838/1 "2021-08-30T15:38:55Z")

</div>

We are building an search experiance for an eccomerce platform. We have a few different content types (different document types) indexed in a few diffrent indicies.

We have tried a few different approaches without any luck to change the current index being used by the search provider but nothing seems to be working, it keep sending the search request to the first index that it was initialized with.

Switching between two diffent indices

 ![](https://us1.discourse-cdn.com/elastic/original/3X/e/c/ecc1ad167ce0eea684e7892efb7a1c830728e45c.png)

Last attemt was to create a whole new `AppSearchAPIConnector` with new `searchKey` and `engineName` in but that didn’t work either.

The`AppSearchAPIConnector` is changed but nex search is done towards old index url, with throws an error since the field set is different

Any ideas on how to toggle the index and make a new search at the same time

@elastic/search-ui: 1.5.1  
@elastic/search-ui-app-search-connector: 1.5.1

Working example would be great.

Thank you for a good product!

---

<div class="post-metadata">

**Author:** ![Scrilling](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/scrilling/32/78663_2.png) [@Scrilling](https://discuss.elastic.co/u/Scrilling)\
**Post date:** [September 6, 2021, 6:45pm UTC](https://discuss.elastic.co/t/toogle-index-in-search-provider-react-search-ui/282838/2 "2021-09-06T18:45:08Z")

</div>

Hi artcups,

It looks like [meta engines](https://www.elastic.co/guide/en/app-search/master/meta-engines-guide.html) would solve the problem you're after. Here's a [blog post](https://www.elastic.co/blog/creating-meta-engines-in-elastic-app-search-to-scale-your-search-experiences) walking through an example use case.

Meta engines require a Platinum License, so I'm not sure if you have access to the feature. If not, I understand that it's possible to support this use case with a bit of custom routing code and components to pull it all together. I unfortunately don't have experience in this area to provide more detail, but wanted to jump on this post in case meta engines are something your team can leverage.

---

<div class="post-metadata">

**Author:** ![lio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lio/32/87276_2.png) [@lio](https://discuss.elastic.co/u/lio)\
**Post date:** [September 13, 2021, 11:14am UTC](https://discuss.elastic.co/t/toogle-index-in-search-provider-react-search-ui/282838/3 "2021-09-13T11:14:44Z")

</div>

Hey artcups,

I actually build a quick demo to show how to query multiple App search engines using the SearchUI, you can see the source code [here](https://github.com/lio-p/search-ui-multiple-engines). In this demo, I use the React router to switch context for each different App search engine.

Hope this helps.

---

<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:** [October 11, 2021, 11:15am UTC](https://discuss.elastic.co/t/toogle-index-in-search-provider-react-search-ui/282838/4 "2021-10-11T11:15:25Z")

</div>

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