ES search and indexing question


(msya) #1

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?

--


(David Pilato) #2

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 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?

--

--


(msya) #3

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. :slight_smile:

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 <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?

--

--


(David Pilato) #4

Have a look at 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 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. :slight_smile:

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 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?

--

--

--


(system) #5