# Beginners Problems

**URL:** <https://discuss.elastic.co/t/beginners-problems/6536>\
**Category:** Elasticsearch\
**Created:** [January 30, 2012, 1:47pm UTC](https://discuss.elastic.co/t/beginners-problems/6536 "2012-01-30T13:47:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sun](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@sun](https://discuss.elastic.co/u/sun)\
**Post date:** [January 30, 2012, 1:47pm UTC](https://discuss.elastic.co/t/beginners-problems/6536/1 "2012-01-30T13:47:39Z")

</div>

Hi, I am new to ES and to search engines in general. I installed  
0.18.7 and my notebook (Mac OS X 10.7.2) and stumble over these  
things:

1. Calling "bin/elasticsearch stop" seems to start a new node instead  
of shutting down ES

2. I pump in data via the Java API but after some thousand documents  
the cluster becomes yellow and I get exceptions calling prepareIndex.

{  
cluster\_name: elasticsearch  
status: yellow  
timed\_out: false  
number\_of\_nodes: 1  
number\_of\_data\_nodes: 1  
active\_primary\_shards: 5  
active\_shards: 5  
relocating\_shards: 0  
initializing\_shards: 0  
unassigned\_shards: 5  
}

Killing the EL process and restarting EL does not change the  
situation. The only thing that works for me is deleting the data  
directory before restarting but this leads into a circle ... I see  
nothing that looks like an error in the log file.

1. I managed to use the Java API to index my data but not to do the  
query I want. The Java documentation needs some more love I think.  
With a matchAllQuery() I get out everything but I wanted something  
like find me the text "xyz" occurring anywhere int the title or the  
text of my document and any one of some given categories. I gave up  
after hours. Can anybody point me in the right direction. I now I need  
to read the source but no time right now.

I need to understand the concepts of ES and search engines much more  
but what I understand so far is fantastic. What have I done so many  
years using only databases? Thanks for the good work and open sourcing  
it. I hope I get over the beginners hurdles quickly.

---

<div class="post-metadata">

**Author:** ![Mauricio\_Linhares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauricio_linhares/32/880_2.png) [@Mauricio\_Linhares](https://discuss.elastic.co/u/Mauricio_Linhares)\
**Post date:** [January 30, 2012, 2:20pm UTC](https://discuss.elastic.co/t/beginners-problems/6536/2 "2012-01-30T14:20:52Z")

</div>

On Mon, Jan 30, 2012 at 10:47 AM, sun [google@suncom.de](mailto:google@suncom.de) wrote:

> Hi, I am new to ES and to search engines in general. I installed  
> 0.18.7 and my notebook (Mac OS X 10.7.2) and stumble over these  
> things:
> 
> 1. Calling "bin/elasticsearch stop" seems to start a new node instead  
> of shutting down ES

You are probably referencing an older version of ES that came with the  
service wrapper script, it is not bundled anymore, you have to grab it  
from here -\> [GitHub - elastic/elasticsearch-servicewrapper: A service wrapper on top of elasticsearch](https://github.com/elasticsearch/elasticsearch-servicewrapper)

But if this is just for starting and stopping on your machine, i'd just do this:

cd "ES\_HOME"/bin  
./elasticsearch -p search.pid # to start  
kill `cat search.pid` # to stop it

> 1. I pump in data via the Java API but after some thousand documents  
> the cluster becomes yellow and I get exceptions calling prepareIndex.
> 
> {  
> cluster\_name: elasticsearch  
> status: yellow  
> timed\_out: false  
> number\_of\_nodes: 1  
> number\_of\_data\_nodes: 1  
> active\_primary\_shards: 5  
> active\_shards: 5  
> relocating\_shards: 0  
> initializing\_shards: 0  
> unassigned\_shards: 5  
> }
> 
> Killing the EL process and restarting EL does not change the  
> situation. The only thing that works for me is deleting the data  
> directory before restarting but this leads into a circle ... I see  
> nothing that looks like an error in the log file.

You said you get exceptions, what exceptions do you get?

> 1. I managed to use the Java API to index my data but not to do the  
> query I want. The Java documentation needs some more love I think.  
> With a matchAllQuery() I get out everything but I wanted something  
> like find me the text "xyz" occurring anywhere int the title or the  
> text of my document and any one of some given categories. I gave up  
> after hours. Can anybody point me in the right direction. I now I need  
> to read the source but no time right now.

A simple example of how query for the text "elastic" in all fields  
from the "news\_story" document:

curl -X GET "[http://localhost:9200/news\_stories/news\_story/\_search?pretty=true](http://localhost:9200/news_stories/news_story/_search?pretty=true)"  
-d '{"query":{"query\_string":{"query":"elastic"}},"size":10,"from":0}'

- 

Maurício Linhares  
[http://techbot.me/](http://techbot.me/) - [http://twitter.com/#!/mauriciojr](http://twitter.com/#!/mauriciojr)

---

<div class="post-metadata">

**Author:** ![sun](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@sun](https://discuss.elastic.co/u/sun)\
**Post date:** [January 30, 2012, 3:51pm UTC](https://discuss.elastic.co/t/beginners-problems/6536/3 "2012-01-30T15:51:51Z")

</div>

Hi Maurício,

thanks for responding, but my questions are still open.

1. I am using version 0.18.7. This morning it was the most actual.

2. and 3. My questions relate to the Java API, not the REST API. The  
exception states that the ES cluster is not reachable (timeout).

Stefan

---

<div class="post-metadata">

**Author:** ![Mauricio\_Linhares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauricio_linhares/32/880_2.png) [@Mauricio\_Linhares](https://discuss.elastic.co/u/Mauricio_Linhares)\
**Post date:** [January 30, 2012, 4:38pm UTC](https://discuss.elastic.co/t/beginners-problems/6536/4 "2012-01-30T16:38:34Z")

</div>

On Mon, Jan 30, 2012 at 12:51 PM, sun [google@suncom.de](mailto:google@suncom.de) wrote:

> Hi Maurício,
> 
> thanks for responding, but my questions are still open.
> 
> 1. I am using version 0.18.7. This morning it was the most actual.

The tutorial piece you are following that says the bin/elasticsearch  
script accepts "start/stop" is outdated, the script that does it is at  
the repo I linked in the previous email, the bin/elasticsearch script  
does not accept "start/stop", but you can use the commands i provided  
in the previous email to start/stop it.

> 1. and 3. My questions relate to the Java API, not the REST API. The  
> exception states that the ES cluster is not reachable (timeout).

If it says the cluster is not reachable either you're not connecting  
to the correct port/ip pair or you don't have an ES server running at  
the port/ip pair you're providing.

- 

Maurício Linhares  
[http://techbot.me/](http://techbot.me/) - [http://twitter.com/#!/mauriciojr](http://twitter.com/#!/mauriciojr)

---

<div class="post-metadata">

**Author:** ![sun](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@sun](https://discuss.elastic.co/u/sun)\
**Post date:** [January 30, 2012, 10:47pm UTC](https://discuss.elastic.co/t/beginners-problems/6536/5 "2012-01-30T22:47:12Z")

</div>

Thanks Maurício,

now I got it.

Anyone can help me with questions 2. and 3.?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 31, 2012, 4:07pm UTC](https://discuss.elastic.co/t/beginners-problems/6536/6 "2012-01-31T16:07:46Z")

</div>

1. The status is yellow, yes, because you start a single node and elasticsearch by default creates 5 shards each with 1 replica. That replica has no place to be allocated to. The yellow health will be there from the start, once you created the index. This will not cause the index to fail though, what exception are you getting? (gist it).

2. It might relate to how you index the data. A gist with a sample of what you index and what you search can help (preferably with curl), but note that by default, text is analyzed and broken down into tokens. If you use term query to search, you might not find anything because its not analyzed (the text in the query), use text query instead.

On Tuesday, January 31, 2012 at 12:47 AM, sun wrote:

> Thanks Maurício,
> 
> now I got it.
> 
> Anyone can help me with questions 2. and 3.?

---

<div class="post-metadata">

**Author:** ![sun](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@sun](https://discuss.elastic.co/u/sun)\
**Post date:** [February 6, 2012, 11:01pm UTC](https://discuss.elastic.co/t/beginners-problems/6536/7 "2012-02-06T23:01:21Z")

</div>

1. I got a timeout exception, no ES exception. I have not got this  
again. I did not understand what a shard or a replica means when I  
asked the question. Now I am reading the lucene documentation and  
slowly the concepts get clearer to me. I think it is necesary to  
understand lucene before starting with ES otherwise the concepts are  
not clear, there are still many terms I need to find in the lucene  
documentation like cluster, node (I guess its not the same as  
QueryNode), replica, mapping, facet.

2. I guess I only implicitely create an index. I tried to create an  
index explicitely with a mapping of which I found an example here:  
[http://groups.google.com/group/elasticsearch/browse\_thread/thread/d92056b2beff1f40/8309396b5eff2f8e?lnk=gst&q=preparePutMapping](http://groups.google.com/group/elasticsearch/browse_thread/thread/d92056b2beff1f40/8309396b5eff2f8e?lnk=gst&q=preparePutMapping)  
But I get an IndexMissingException.

I published a gist here git://gist.github.com/1755678.git. It is in  
Scala, but very close to Java. I am just iterating per reflection over  
all my model properties.  
I tried to work with JSON but without success, I write a separate  
question about it.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 7, 2012, 10:22am UTC](https://discuss.elastic.co/t/beginners-problems/6536/8 "2012-02-07T10:22:29Z")

</div>

On Tuesday, February 7, 2012 at 1:01 AM, sun wrote:

> 1. I got a timeout exception, no ES exception. I have not got this  
> again. I did not understand what a shard or a replica means when I  
> asked the question. Now I am reading the lucene documentation and  
> slowly the concepts get clearer to me. I think it is necesary to  
> understand lucene before starting with ES otherwise the concepts are  
> not clear, there are still many terms I need to find in the lucene  
> documentation like cluster, node (I guess its not the same as  
> QueryNode), replica, mapping, facet.

All of those are elasticsearch concepts, not Lucene 🙂

> 1. I guess I only implicitely create an index. I tried to create an  
> index explicitely with a mapping of which I found an example here:  
> [http://groups.google.com/group/elasticsearch/browse\_thread/thread/d92056b2beff1f40/8309396b5eff2f8e?lnk=gst&q=preparePutMapping](http://groups.google.com/group/elasticsearch/browse_thread/thread/d92056b2beff1f40/8309396b5eff2f8e?lnk=gst&q=preparePutMapping)  
> But I get an IndexMissingException.
> 
> I published a gist here git://gist.github.com/1755678.git ([Create a lucene index from a model · GitHub](http://gist.github.com/1755678.git)). It is in  
> Scala, but very close to Java. I am just iterating per reflection over  
> all my model properties.  
> I tried to work with JSON but without success, I write a separate  
> question about it.

---

<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, 3:40am UTC](https://discuss.elastic.co/t/beginners-problems/6536/9 "2017-07-06T03:40:19Z")

</div>


