# Elastic Search High CPU 100%

**URL:** <https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195>\
**Category:** Elasticsearch\
**Created:** [August 13, 2013, 9:04am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195 "2013-08-13T09:04:36Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![anasjaghoub](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@anasjaghoub](https://discuss.elastic.co/u/anasjaghoub)\
**Post date:** [August 13, 2013, 9:04am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/1 "2013-08-13T09:04:36Z")

</div>

I've a problem with elastic search that it consumes 100% of cpu when I do  
search with faceting for a huge index around 5g its size and have more that  
1Million docs inside.

Attached is file for hot thread dump when cpu reaches 100% , moreover the  
request takes too much time before I get take response from elastic more  
than 5 seconds delay!.

Main configurations I've are:

ES\_HEAP\_SIZE=5024  
ES\_MIN\_MEM=5024  
ES\_MAX\_MEM=5024

index.number\_of\_shards: 20

ES version 0.9.2 and installed on amazon m1 large instance , and installed  
on EBS volume with 150GB size.

Please help me in getting over this problem.

Thanks,

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [August 13, 2013, 9:10am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/2 "2013-08-13T09:10:37Z")

</div>

I notice you use JDBC river. For best performance while faceting, it may  
help to disable the JDBC river.

Thanks,

Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![anasjaghoub](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@anasjaghoub](https://discuss.elastic.co/u/anasjaghoub)\
**Post date:** [August 13, 2013, 9:16am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/3 "2013-08-13T09:16:25Z")

</div>

thanks Jörg for ur help, actually I use jdbc for indexing from mysql db.  
how can I disable it when faceting?

thanks

On Tuesday, August 13, 2013 12:10:37 PM UTC+3, Jörg Prante wrote:

> I notice you use JDBC river. For best performance while faceting, it may  
> help to disable the JDBC river.
> 
> Thanks,
> 
> Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [August 13, 2013, 9:29am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/4 "2013-08-13T09:29:43Z")

</div>

Just remove the river, before faceting

curl -XDELETE '[http://localhost:9200/\_river/my\_jdbc\_river\_name/](http://localhost:9200/_river/my_jdbc_river_name/)'

Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![anasjaghoub](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@anasjaghoub](https://discuss.elastic.co/u/anasjaghoub)\
**Post date:** [August 13, 2013, 9:42am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/5 "2013-08-13T09:42:47Z")

</div>

does it remove the whole index ?

On Tuesday, August 13, 2013 12:29:43 PM UTC+3, Jörg Prante wrote:

> Just remove the river, before faceting
> 
> curl -XDELETE '[http://localhost:9200/\_river/my\_jdbc\_river\_name/](http://localhost:9200/_river/my_jdbc_river_name/)'
> 
> Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [August 13, 2013, 9:44am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/6 "2013-08-13T09:44:34Z")

</div>

No, it stops river activity, and removes the river metadata from ES.

Jörg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [August 13, 2013, 10:46am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/7 "2013-08-13T10:46:40Z")

</div>

Hey,

it seems you are using some scripts that fetch stored fields, is that  
possible ie. you are using the \_source in the script or something like  
that? Can you maybe provide your query or one of them using scripts?

This will almost guarantee that your machine is spinning 100% CPU all the  
time 🙂

simon

On Tuesday, August 13, 2013 11:04:36 AM UTC+2, Anas Jaghoub wrote:

> I've a problem with Elasticsearch that it consumes 100% of cpu when I do  
> search with faceting for a huge index around 5g its size and have more that  
> 1Million docs inside.
> 
> Attached is file for hot thread dump when cpu reaches 100% , moreover the  
> request takes too much time before I get take response from elastic more  
> than 5 seconds delay!.
> 
> Main configurations I've are:
> 
> ES\_HEAP\_SIZE=5024  
> ES\_MIN\_MEM=5024  
> ES\_MAX\_MEM=5024
> 
> index.number\_of\_shards: 20
> 
> ES version 0.9.2 and installed on amazon m1 large instance , and installed  
> on EBS volume with 150GB size.
> 
> Please help me in getting over this problem.
> 
> Thanks,

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![anasjaghoub](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@anasjaghoub](https://discuss.elastic.co/u/anasjaghoub)\
**Post date:** [August 13, 2013, 11:17am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/8 "2013-08-13T11:17:09Z")

</div>

Jörg, I've deleted it , and the same thing it keeps loading for more than  
5 seconds with cpu 100%.  
attached the hot threads log after deleting jdbc river.

On Tuesday, August 13, 2013 12:04:36 PM UTC+3, Anas Jaghoub wrote:

> I've a problem with Elasticsearch that it consumes 100% of cpu when I do  
> search with faceting for a huge index around 5g its size and have more that  
> 1Million docs inside.
> 
> Attached is file for hot thread dump when cpu reaches 100% , moreover the  
> request takes too much time before I get take response from elastic more  
> than 5 seconds delay!.
> 
> Main configurations I've are:
> 
> ES\_HEAP\_SIZE=5024  
> ES\_MIN\_MEM=5024  
> ES\_MAX\_MEM=5024
> 
> index.number\_of\_shards: 20
> 
> ES version 0.9.2 and installed on amazon m1 large instance , and installed  
> on EBS volume with 150GB size.
> 
> Please help me in getting over this problem.
> 
> Thanks,

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![anasjaghoub](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@anasjaghoub](https://discuss.elastic.co/u/anasjaghoub)\
**Post date:** [August 13, 2013, 11:27am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/9 "2013-08-13T11:27:04Z")

</div>

Hi Simonw,

Yep, I use \_source for faceting by terms, since I need to group by the  
whole terms in the field. Below is the query I use:

{"query":{"bool":{"must":[[{"range":{"posts.record\_insert\_date":{"gte":"2008-01-01"}}}]]}},"facets":{"posts|record\_insert\_date":{"date\_histogram":{"interval":"month","field":"posts.record\_insert\_date"}},"categories\_new|name":{"terms":{"script\_field":"\_source.posts.categories\_new.name","all\_terms":true}},"countries|name":{"terms":{"script\_field":"\_source.posts.countries.name","all\_terms":true}}}}

On Tuesday, August 13, 2013 1:46:40 PM UTC+3, simonw wrote:

> Hey,
> 
> it seems you are using some scripts that fetch stored fields, is that  
> possible ie. you are using the \_source in the script or something like  
> that? Can you maybe provide your query or one of them using scripts?
> 
> This will almost guarantee that your machine is spinning 100% CPU all the  
> time 🙂
> 
> simon
> 
> On Tuesday, August 13, 2013 11:04:36 AM UTC+2, Anas Jaghoub wrote:
> 
> > I've a problem with Elasticsearch that it consumes 100% of cpu when I do  
> > search with faceting for a huge index around 5g its size and have more that  
> > 1Million docs inside.
> > 
> > Attached is file for hot thread dump when cpu reaches 100% , moreover the  
> > request takes too much time before I get take response from elastic more  
> > than 5 seconds delay!.
> > 
> > Main configurations I've are:
> > 
> > ES\_HEAP\_SIZE=5024  
> > ES\_MIN\_MEM=5024  
> > ES\_MAX\_MEM=5024
> > 
> > index.number\_of\_shards: 20
> > 
> > ES version 0.9.2 and installed on amazon m1 large instance , and  
> > installed on EBS volume with 150GB size.
> > 
> > Please help me in getting over this problem.
> > 
> > Thanks,

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [August 13, 2013, 3:42pm UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/10 "2013-08-13T15:42:19Z")

</div>

hey why don't you just use

{ "terms" : { "field" : "posts.countries.name", "all\_terms" : true} }  
instead

simon

On Tuesday, August 13, 2013 1:27:04 PM UTC+2, Anas Jaghoub wrote:

> Hi Simonw,
> 
> Yep, I use \_source for faceting by terms, since I need to group by the  
> whole terms in the field. Below is the query I use:
> 
> {"query":{"bool":{"must":[[{"range":{"posts.record\_insert\_date":{"gte":"2008-01-01"}}}]]}},"facets":{"posts|record\_insert\_date":{"date\_histogram":{"interval":"month","field":"posts.record\_insert\_date"}},"categories\_new|name":{"terms":{"script\_field":"\_  
> source.posts.categories\_new.name  
> ","all\_terms":true}},"countries|name":{"terms":{"script\_field":"\_  
> source.posts.countries.name","all\_terms":true}}}}
> 
> On Tuesday, August 13, 2013 1:46:40 PM UTC+3, simonw wrote:
> 
> > Hey,
> > 
> > it seems you are using some scripts that fetch stored fields, is that  
> > possible ie. you are using the \_source in the script or something like  
> > that? Can you maybe provide your query or one of them using scripts?
> > 
> > This will almost guarantee that your machine is spinning 100% CPU all the  
> > time 🙂
> > 
> > simon
> > 
> > On Tuesday, August 13, 2013 11:04:36 AM UTC+2, Anas Jaghoub wrote:
> > 
> > > I've a problem with Elasticsearch that it consumes 100% of cpu when I  
> > > do search with faceting for a huge index around 5g its size and have more  
> > > that 1Million docs inside.
> > > 
> > > Attached is file for hot thread dump when cpu reaches 100% , moreover  
> > > the request takes too much time before I get take response from elastic  
> > > more than 5 seconds delay!.
> > > 
> > > Main configurations I've are:
> > > 
> > > ES\_HEAP\_SIZE=5024  
> > > ES\_MIN\_MEM=5024  
> > > ES\_MAX\_MEM=5024
> > > 
> > > index.number\_of\_shards: 20
> > > 
> > > ES version 0.9.2 and installed on amazon m1 large instance , and  
> > > installed on EBS volume with 150GB size.
> > > 
> > > Please help me in getting over this problem.
> > > 
> > > Thanks,

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:21am UTC](https://discuss.elastic.co/t/elastic-search-high-cpu-100/13195/11 "2017-07-06T02:21:18Z")

</div>


