Search in index using other index field


(vannya) #1

Hi all!

I'm facing a problem, and I would like to know if anyone knows a solution.
So, I have 2 indexes in elastisearch: my_index1 and my_index2.

What I would like to do is: use one field from my_index1 docs to filter
documents from my_index2.
Can I do this?

Thanks in advance!


(Radu Gheorghe) #2

Hi Vania,

Maybe it's just me, but I'm not sure exactly what you're trying to
achieve. Can you give an example?

On Mar 15, 5:25 pm, "Vania S." vann...@gmail.com wrote:

Hi all!

I'm facing a problem, and I would like to know if anyone knows a solution.
So, I have 2 indexes in elastisearch: my_index1 and my_index2.

What I would like to do is: use one field from my_index1 docs to filter
documents from my_index2.
Can I do this?

Thanks in advance!


(Clinton Gormley) #3

Hiya

I'm facing a problem, and I would like to know if anyone knows a
solution.
So, I have 2 indexes in elastisearch: my_index1 and my_index2.

What I would like to do is: use one field from my_index1 docs to
filter documents from my_index2.

The only way to do this is to run two queries: the first on my_index1 to
get the values you want to filter on, then the second on my_index2, with
those values passed in to the query.

clint

Can I do this?

Thanks in advance!


(vannya) #4

Hi!

Thanks for the replies!

Radu, here goes an example:

In index2 I have some docs with a field called clientId.
In index1 I have a list of docs with 2 fields: clientName and clientId.

The indexes sources are different and index2 is a narrowed list of clients.
What I want to do is something like:
"give me all documents of index1 where clientId is equal do documents in
index2".

Clinton,

Thanks for the reply, but I'm trying not to bring the results to the
elastic client.
Doing 2 queries means that I have to bring both results to client side, and
this might be really heavy.

Thanks!

On Thursday, March 15, 2012 3:25:51 PM UTC, Vania S. wrote:

Hi all!

I'm facing a problem, and I would like to know if anyone knows a solution.
So, I have 2 indexes in elastisearch: my_index1 and my_index2.

What I would like to do is: use one field from my_index1 docs to filter
documents from my_index2.
Can I do this?

Thanks in advance!


(David Pilato) #5

Why don't you index client name in index 1 instead of it's id ?

David :wink:
@dadoonet

Le 16 mars 2012 à 11:42, "Vania S." vannyas@gmail.com a écrit :

Hi!

Thanks for the replies!

Radu, here goes an example:

In index2 I have some docs with a field called clientId.
In index1 I have a list of docs with 2 fields: clientName and clientId.

The indexes sources are different and index2 is a narrowed list of clients. What I want to do is something like:
"give me all documents of index1 where clientId is equal do documents in index2".

Clinton,

Thanks for the reply, but I'm trying not to bring the results to the elastic client.
Doing 2 queries means that I have to bring both results to client side, and this might be really heavy.

Thanks!

On Thursday, March 15, 2012 3:25:51 PM UTC, Vania S. wrote:
Hi all!

I'm facing a problem, and I would like to know if anyone knows a solution.
So, I have 2 indexes in elastisearch: my_index1 and my_index2.

What I would like to do is: use one field from my_index1 docs to filter documents from my_index2.
Can I do this?

Thanks in advance!


(vannya) #6

David,

The indexed information comes from different systems, and I don't have
control over the structure of the information.
I would like to do a "kind of join" between both indexes, because index2
have a narrowed list of clients, and I want to get the information from
index1 that matches information from index2.

Thanks!

On Thursday, March 15, 2012 3:25:51 PM UTC, Vania S. wrote:

Hi all!

I'm facing a problem, and I would like to know if anyone knows a solution.
So, I have 2 indexes in elastisearch: my_index1 and my_index2.

What I would like to do is: use one field from my_index1 docs to filter
documents from my_index2.
Can I do this?

Thanks in advance!


(Shay Banon) #7

The only way to do it is as clinton suggested, there is no built in join
between indices.

On Fri, Mar 16, 2012 at 12:54 PM, Vania S. vannyas@gmail.com wrote:

David,

The indexed information comes from different systems, and I don't have
control over the structure of the information.
I would like to do a "kind of join" between both indexes, because index2
have a narrowed list of clients, and I want to get the information from
index1 that matches information from index2.

Thanks!

On Thursday, March 15, 2012 3:25:51 PM UTC, Vania S. wrote:

Hi all!

I'm facing a problem, and I would like to know if anyone knows a solution.
So, I have 2 indexes in elastisearch: my_index1 and my_index2.

What I would like to do is: use one field from my_index1 docs to filter
documents from my_index2.
Can I do this?

Thanks in advance!


(system) #8