# ES search and indexing question

**URL:** <https://discuss.elastic.co/t/es-search-and-indexing-question/8752>\
**Category:** Elasticsearch\
**Created:** [August 15, 2012, 8:22pm UTC](https://discuss.elastic.co/t/es-search-and-indexing-question/8752 "2012-08-15T20:22:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![msya](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@msya](https://discuss.elastic.co/u/msya)\
**Post date:** [August 15, 2012, 8:22pm UTC](https://discuss.elastic.co/t/es-search-and-indexing-question/8752/1 "2012-08-15T20:22:53Z")

</div>

Hello,

I am trying to integrate ElasticSearch into a web app. When I do a search  
for some word, I want ElasticSearch to give me back all the questions and  
replies that contain my search keyword.

Currently, I have a question and reply indexed as such:

\_index: "community\_id\_123"  
\_type: "question"  
question: "Hello How are you

\_index: "community\_id\_123"  
\_type: "reply"  
question: "hey you fine"

So, if I wanted to search for the word "you" in both a reply and a  
question, I would have to perform two CURL calls, one for question and  
reply. Is there a better way to do this? Is there a way where I wouldn't  
have to perform two CURL calls?

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 15, 2012, 8:28pm UTC](https://discuss.elastic.co/t/es-search-and-indexing-question/8752/2 "2012-08-15T20:28:01Z")

</div>

You can query on a type, on an index or on the whole cluster:

curl localhost:9200/community\_id\_123/question/\_search?...  
curl localhost:9200/community\_id\_123/\_search?...  
curl localhost:9200/\_search?...

Also:  
curl localhost:9200/community\_id\_123/question,answer/\_search?...

HTH  
David

--

Le 15 août 2012 à 22:22, msya [mohitsya@gmail.com](mailto:mohitsya@gmail.com) a écrit :

> Hello,
> 
> I am trying to integrate Elasticsearch into a web app. When I do a search for some word, I want Elasticsearch to give me back all the questions and replies that contain my search keyword.
> 
> Currently, I have a question and reply indexed as such:
> 
> \_index: "community\_id\_123"  
> \_type: "question"  
> question: "Hello How are you
> 
> \_index: "community\_id\_123"  
> \_type: "reply"  
> question: "hey you fine"
> 
> So, if I wanted to search for the word "you" in both a reply and a question, I would have to perform two CURL calls, one for question and reply. Is there a better way to do this? Is there a way where I wouldn't have to perform two CURL calls?
> 
> --

--

---

<div class="post-metadata">

**Author:** ![msya](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@msya](https://discuss.elastic.co/u/msya)\
**Post date:** [August 15, 2012, 9:31pm UTC](https://discuss.elastic.co/t/es-search-and-indexing-question/8752/3 "2012-08-15T21:31:42Z")

</div>

Hello David,

Thank you for answering my question. I tried what you said and it worked. I  
am just starting to integrate Elasticsearch in a app as its search engine.  
Expect a lot of questions from me! Thank you again for the help. 🙂

On Wednesday, August 15, 2012 4:28:01 PM UTC-4, David Pilato wrote:

> You can query on a type, on an index or on the whole cluster:
> 
> curl localhost:9200/community\_id\_123/question/\_search?...  
> curl localhost:9200/community\_id\_123/\_search?...  
> curl localhost:9200/\_search?...
> 
> Also:  
> curl localhost:9200/community\_id\_123/question,answer/\_search?...
> 
> HTH  
> David
> 
> --
> 
> Le 15 août 2012 à 22:22, msya \<[mohi...@gmail.com](mailto:mohi...@gmail.com) \<javascript:\>\> a écrit :
> 
> Hello,
> 
> I am trying to integrate Elasticsearch into a web app. When I do a search  
> for some word, I want Elasticsearch to give me back all the questions and  
> replies that contain my search keyword.
> 
> Currently, I have a question and reply indexed as such:
> 
> \_index: "community\_id\_123"  
> \_type: "question"  
> question: "Hello How are you
> 
> \_index: "community\_id\_123"  
> \_type: "reply"  
> question: "hey you fine"
> 
> So, if I wanted to search for the word "you" in both a reply and a  
> question, I would have to perform two CURL calls, one for question and  
> reply. Is there a better way to do this? Is there a way where I wouldn't  
> have to perform two CURL calls?
> 
> --

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 16, 2012, 2:12am UTC](https://discuss.elastic.co/t/es-search-and-indexing-question/8752/4 "2012-08-16T02:12:09Z")

</div>

Have a look at [http://www.scrutmydocs.org](http://www.scrutmydocs.org) project.  
It's an open source webapp which integrates ES. It's only a start but you can find some ideas there.

David

--

Le 15 août 2012 à 23:31, msya [mohitsya@gmail.com](mailto:mohitsya@gmail.com) a écrit :

> Hello David,
> 
> Thank you for answering my question. I tried what you said and it worked. I am just starting to integrate Elasticsearch in a app as its search engine. Expect a lot of questions from me! Thank you again for the help. 🙂
> 
> On Wednesday, August 15, 2012 4:28:01 PM UTC-4, David Pilato wrote:  
> You can query on a type, on an index or on the whole cluster:
> 
> curl localhost:9200/community\_id\_123/question/\_search?...  
> curl localhost:9200/community\_id\_123/\_search?...  
> curl localhost:9200/\_search?...
> 
> Also:  
> curl localhost:9200/community\_id\_123/question,answer/\_search?...
> 
> HTH  
> David
> 
> --
> 
> Le 15 août 2012 à 22:22, msya [mohi...@gmail.com](mailto:mohi...@gmail.com) a écrit :
> 
> > Hello,
> > 
> > I am trying to integrate Elasticsearch into a web app. When I do a search for some word, I want Elasticsearch to give me back all the questions and replies that contain my search keyword.
> > 
> > Currently, I have a question and reply indexed as such:
> > 
> > \_index: "community\_id\_123"  
> > \_type: "question"  
> > question: "Hello How are you
> > 
> > \_index: "community\_id\_123"  
> > \_type: "reply"  
> > question: "hey you fine"
> > 
> > So, if I wanted to search for the word "you" in both a reply and a question, I would have to perform two CURL calls, one for question and reply. Is there a better way to do this? Is there a way where I wouldn't have to perform two CURL calls?
> > 
> > --
> 
> --

--

---

<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:16am UTC](https://discuss.elastic.co/t/es-search-and-indexing-question/8752/5 "2017-07-06T03:16:14Z")

</div>


