# One Search Box:results from different engines in two different tabs

**URL:** https://discuss.elastic.co/t/one-search-box-results-from-different-engines-in-two-different-tabs/217093
**Category:** Elastic Search
**Tags:** elastic-app-search
**Created:** [January 30, 2020, 1:44am UTC](https://discuss.elastic.co/t/one-search-box-results-from-different-engines-in-two-different-tabs/217093 "2020-01-30T01:44:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![georgina](https://avatars.discourse-cdn.com/v4/letter/g/ba8739/32.png) [@georgina](https://discuss.elastic.co/u/georgina)
#### Post date: [January 30, 2020, 1:44am UTC](https://discuss.elastic.co/t/one-search-box-results-from-different-engines-in-two-different-tabs/217093/1 "2020-01-30T01:44:28Z")

</div>

Continuing the discussion from [How to implement proximity search in app search](https://discuss.elastic.co/t/how-to-implement-proximity-search-in-app-search/203966/11):

I am trying to get this to work but am struggling to convert the pseudo code into working code.

Are you able to explain this some more, for a react newbie?

Pseudocode from [How to implement proximity search in app search - #11 by JasonStoltz](https://discuss.elastic.co/t/how-to-implement-proximity-search-in-app-search/203966/11)

```
state = {
  engine: 'engine1'
}
const connector = new AppSearchAPIConnector({
    searchKey: "",
    engineName: this.state.engineName,
    hostIdentifier: ""
});

return <SearchProvider
  config={{
      apiConnector: connector
  }}
>
   <div>
        <SearchBox />
           <Tab1 id="tab1" onClick={() => setState({ engine: 'engine1' })}/>
          <Tab2 id="tab1" onClick={() => setState({ engine: 'engine2' })}/>
   </div>
</SearchProvider>

```

---

<div class="post-metadata">

### Author: ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)
#### Post date: [January 30, 2020, 11:55am UTC](https://discuss.elastic.co/t/one-search-box-results-from-different-engines-in-two-different-tabs/217093/2 "2020-01-30T11:55:51Z")

</div>

@georgina I put together a quick demo of this: [https://codesandbox.io/s/search-ui-tabs-2-different-engines-ubg3g](https://codesandbox.io/s/search-ui-tabs-2-different-engines-ubg3g).

This is just a starting point. I think it may be a challenge to get that to work well.

If you can, I'd recommend an alternative approach. I recommend putting all of your documents into a single engine. Use a "type" field for the type of document, rather than putting them into separate engines.

You can then create a "facet" for type, and build your tabs from that "facet". This is the approach we take on [elastic.co](http://elastic.co) and it works nicely: [https://www.elastic.co/search?q=kibana&size=20](https://www.elastic.co/search?q=kibana&size=20).

Hope that helps,

Jason

---

<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: [February 27, 2020, 11:55am UTC](https://discuss.elastic.co/t/one-search-box-results-from-different-engines-in-two-different-tabs/217093/3 "2020-02-27T11:55:52Z")

</div>

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