# Slow response time on Swiftype search

**URL:** <https://discuss.elastic.co/t/slow-response-time-on-swiftype-search/257189>\
**Category:** Elastic Search\
**Tags:** elastic-site-search\
**Created:** [December 1, 2020, 10:20am UTC](https://discuss.elastic.co/t/slow-response-time-on-swiftype-search/257189 "2020-12-01T10:20:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![petas](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@petas](https://discuss.elastic.co/u/petas)\
**Post date:** [December 1, 2020, 10:20am UTC](https://discuss.elastic.co/t/slow-response-time-on-swiftype-search/257189/1 "2020-12-01T10:20:15Z")

</div>

Hi,

We are experiencing very slow response times from Swiftype. From our express app, we are using a very simple search query to Swiftype, and we get response times of 600-6000ms. This feels very unstable and slow. Do you have any ideas on what can be causing this? We are using the standard plan, but our guess is that the standard plan is not expected to be this unstable? We currently only have 260 crawled documents btw.

Here is the only thing we’re doing when requesting Swiftype:

```auto
    try {
      const { queryString, locale } = req.query
      const client = new SiteSearchClient({
        apiKey: process.env.SITE_SEARCH_API_KEY,
      })
      client.search(
        {
           engine: process.env.SITE_SEARCH_ENGINE_SLUG,
           q: queryString,
           filters: {
              page: {
                 locale: locale,
              },
           },
        },
    (error, response) => {
      if (response) {
      res.send(response)
    }
    if (error) {
      console.error(error)
      returnErrorContentApi('Bad response.', prefix)
    }
    next()
    }
    )
    } catch (error) {
    console.error(error)
    returnErrorContentApi('Bad response.', prefix)
    }

```

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![constancecchen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/constancecchen/32/71762_2.png) [@constancecchen](https://discuss.elastic.co/u/constancecchen)\
**Post date:** [December 1, 2020, 4:47pm UTC](https://discuss.elastic.co/t/slow-response-time-on-swiftype-search/257189/2 "2020-12-01T16:47:46Z")

</div>

Hi Petas,

Just to check, what general continent/region are you making requests from? Traffic from Europe requests are expected to take ~400ms longer than from the mainland US (speed of light + HTTPS handshake protocol specifics).

There is a way to lean on our API POP nodes around the world to help with the issue though. You can replace `api.swiftype.com` in your request with `search-api.swiftype.com` and your traffic will be routed through a network of our POP nodes which should cut SSL handshake and TCP connection time significantly.

It looks like you're using the Site Search Node client - you should be able to [override the host used](https://github.com/elastic/site-search-node/blob/master/lib/siteSearch.js#L12) to `search-api.swiftype.com` by setting `config.host`.

Another alternative option for gaining some speed might be to try using `suggest.json`/`client.suggest` instead of `search.json`, as users have previously reported gaining 100ms or so with smaller searches.

Hope that helps,  
Constance

---

<div class="post-metadata">

**Author:** ![petas](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@petas](https://discuss.elastic.co/u/petas)\
**Post date:** [December 2, 2020, 2:33pm UTC](https://discuss.elastic.co/t/slow-response-time-on-swiftype-search/257189/3 "2020-12-02T14:33:57Z")

</div>

Hi Constance,

Thank you for the helpful answer! Using the API POP-approach our response time dropped to around 250-300ms fairly consistently, which of course is much better!

Once more, thank you for the great answer.

---

<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:** [December 30, 2020, 2:33pm UTC](https://discuss.elastic.co/t/slow-response-time-on-swiftype-search/257189/4 "2020-12-30T14:33:59Z")

</div>

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