How to "join" select with two indces?


(Yuhan) #1

Hi all,

I'd like to perform a join search between two indices. Is this doable in
elasticsearch?

Thank you.

Yuhan


(David Pilato) #2

Search in all indices or with index1,index2/_search

HTH
David

--

Le 20 juil. 2012 à 00:33, Yuhan Zhang yzhang@onescreen.com a écrit :

Hi all,

I'd like to perform a join search between two indices. Is this doable in elasticsearch?

Thank you.

Yuhan


(Yuhan) #3

Hi David,

a question about the query: in case of that index1 and index2 both have doc
id=1, will this query return 2 docs with id=1 or 1 doc with id=1 with
fields from both? ... I guess I have to make some experiments. thanks for
the answer. it is helpful.

Thank you.

Yuhan

On Thu, Jul 19, 2012 at 3:38 PM, David Pilato david@pilato.fr wrote:

Search in all indices or with index1,index2/_search

HTH
David

--

Le 20 juil. 2012 à 00:33, Yuhan Zhang yzhang@onescreen.com a écrit :

Hi all,

I'd like to perform a join search between two indices. Is this doable in
elasticsearch?

Thank you.

Yuhan

--
Yuhan Zhang
Senior Software Engineer
OneScreen Inc.
yzhang@onescreen.com ehorne@onescreen.com
www.onescreen.com

The information contained in this e-mail is for the exclusive use of the
intended recipient(s) and may be confidential, proprietary, and/or legally
privileged. Inadvertent disclosure of this message does not constitute a
waiver of any privilege. If you receive this message in error, please do
not directly or indirectly print, copy, retransmit, disseminate, or
otherwise use the information. In addition, please delete this e-mail and
all copies and notify the sender.


(Yuhan) #4

hmm, looks like it returns 2 docs on from each index. I'd like to perform
something similar to join in sql to find docs with same that have contains
different terms in different indices... looks like they have to be in the
same doc in case of using elasticsearch.

Thanks for the help.

Yuhan

On Thu, Jul 19, 2012 at 4:46 PM, Yuhan Zhang yzhang@onescreen.com wrote:

Hi David,

a question about the query: in case of that index1 and index2 both have
doc id=1, will this query return 2 docs with id=1 or 1 doc with id=1 with
fields from both? ... I guess I have to make some experiments. thanks for
the answer. it is helpful.

Thank you.

Yuhan

On Thu, Jul 19, 2012 at 3:38 PM, David Pilato david@pilato.fr wrote:

Search in all indices or with index1,index2/_search

HTH
David

--

Le 20 juil. 2012 à 00:33, Yuhan Zhang yzhang@onescreen.com a écrit :

Hi all,

I'd like to perform a join search between two indices. Is this doable
in elasticsearch?

Thank you.

Yuhan

--
Yuhan Zhang
Senior Software Engineer
OneScreen Inc.
yzhang@onescreen.com ehorne@onescreen.com
www.onescreen.com

The information contained in this e-mail is for the exclusive use of the
intended recipient(s) and may be confidential, proprietary, and/or legally
privileged. Inadvertent disclosure of this message does not constitute a
waiver of any privilege. If you receive this message in error, please do
not directly or indirectly print, copy, retransmit, disseminate, or
otherwise use the information. In addition, please delete this e-mail and
all copies and notify the sender.

--
Yuhan Zhang
Senior Software Engineer
OneScreen Inc.
yzhang@onescreen.com ehorne@onescreen.com
www.onescreen.com

The information contained in this e-mail is for the exclusive use of the
intended recipient(s) and may be confidential, proprietary, and/or legally
privileged. Inadvertent disclosure of this message does not constitute a
waiver of any privilege. If you receive this message in error, please do
not directly or indirectly print, copy, retransmit, disseminate, or
otherwise use the information. In addition, please delete this e-mail and
all copies and notify the sender.


(David Pilato) #5

For Elasticsearch, a document is unique with its coordinates :
_index
_type
_id

So, you will get back two different documents even if content is exactly the same.

Can you illustrate your use case with an example?

Why do you have the same document in two index? Why do you have two index?

David

Le 20 juil. 2012 à 02:02, Yuhan Zhang yzhang@onescreen.com a écrit :

hmm, looks like it returns 2 docs on from each index. I'd like to perform something similar to join in sql to find docs with same that have contains different terms in different indices... looks like they have to be in the same doc in case of using elasticsearch.

Thanks for the help.

Yuhan

On Thu, Jul 19, 2012 at 4:46 PM, Yuhan Zhang yzhang@onescreen.com wrote:
Hi David,

a question about the query: in case of that index1 and index2 both have doc id=1, will this query return 2 docs with id=1 or 1 doc with id=1 with fields from both? ... I guess I have to make some experiments. thanks for the answer. it is helpful.

Thank you.

Yuhan

On Thu, Jul 19, 2012 at 3:38 PM, David Pilato david@pilato.fr wrote:
Search in all indices or with index1,index2/_search

HTH
David

--

Le 20 juil. 2012 à 00:33, Yuhan Zhang yzhang@onescreen.com a écrit :

Hi all,

I'd like to perform a join search between two indices. Is this doable in elasticsearch?

Thank you.

Yuhan

--
Yuhan Zhang
Senior Software Engineer
OneScreen Inc.
yzhang@onescreen.com
www.onescreen.com

The information contained in this e-mail is for the exclusive use of the intended recipient(s) and may be confidential, proprietary, and/or legally privileged. Inadvertent disclosure of this message does not constitute a waiver of any privilege. If you receive this message in error, please do not directly or indirectly print, copy, retransmit, disseminate, or otherwise use the information. In addition, please delete this e-mail and all copies and notify the sender.

--
Yuhan Zhang
Senior Software Engineer
OneScreen Inc.
yzhang@onescreen.com
www.onescreen.com

The information contained in this e-mail is for the exclusive use of the intended recipient(s) and may be confidential, proprietary, and/or legally privileged. Inadvertent disclosure of this message does not constitute a waiver of any privilege. If you receive this message in error, please do not directly or indirectly print, copy, retransmit, disseminate, or otherwise use the information. In addition, please delete this e-mail and all copies and notify the sender.


(system) #6