# Index API very slow at first time

**URL:** <https://discuss.elastic.co/t/index-api-very-slow-at-first-time/85230>\
**Category:** Elasticsearch\
**Created:** [May 10, 2017, 10:55am UTC](https://discuss.elastic.co/t/index-api-very-slow-at-first-time/85230 "2017-05-10T10:55:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shoya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shoya/32/16475_2.png) [@shoya](https://discuss.elastic.co/u/shoya)\
**Post date:** [May 10, 2017, 10:55am UTC](https://discuss.elastic.co/t/index-api-very-slow-at-first-time/85230/1 "2017-05-10T10:55:27Z")

</div>

# Environment

- Elastic Search 2.4.0 on Elastic Cloud
- Cluster Size Mem:2GB Stor:48GB
- Access from node.js client. "elasticsearch": "^11.0.1

# Question

I try index this JSON param. but very slow at first time.  
response time is 10000~13000ms on average.  
is it too deep nested?  
can you guess why? please tell me if I mistake.

```auto
{ 
	 "name": "test-name",
     "description": "test-description",
     "integrations": { 
      	"wechat":{ 
         	"Token": null
         },
        "facebook": { 
        	"Token": null
    	} 
	},
    "accountId": "8a4f260fc9c9449aa469bef9743a3a50",
    "appId": "641023dc27fe4743b6982fd1e0937968",
    "status": "active",
    "createdAt": "2017-05-10T10:09:00.548Z",
    "updatedAt": "2017-05-10T10:09:00.548Z",
    "options": [],
    "message": {
    	"title": null,
    	"text": null
    },
    "message2": {
    	"contents": [ 
    		{ 
    			"text": "text",
    			"contentType": "text" 
    		}
    	]
    },
    "apiKey": "60099855997d4898a5a1944d963ff992" 
 } 

```

thanks

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [May 12, 2017, 6:54am UTC](https://discuss.elastic.co/t/index-api-very-slow-at-first-time/85230/2 "2017-05-12T06:54:41Z")

</div>

There's no obvious reason why indexing this document would be so slow. Locally it takes a few milliseconds. Do you have any other mapping or index templates or anything?

You say this is slow the first time, so fast after that? Perhaps DNS lookup or something like that?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 12, 2017, 7:10am UTC](https://discuss.elastic.co/t/index-api-very-slow-at-first-time/85230/3 "2017-05-12T07:10:17Z")

</div>

Is this document indexed into a new index so that it includes the time it takes to create it? If so, how many indices and shards do you have in the cluster?

---

<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:** [June 9, 2017, 7:20am UTC](https://discuss.elastic.co/t/index-api-very-slow-at-first-time/85230/4 "2017-06-09T07:20:23Z")

</div>

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