Searching over multiple indices while only returning one hit for every id, according to the order of the indices specified

Hi,
is it currently possible to search over multiple indices and only
return one hit for every id?

I have the following situation:
index1 holds docid1
index2 holds docid1 and docid2.

When I search over indices index1,index2 I get 3 matches
docid1[index1], docid1[index2], docid2[index2].

My question is if it is possible to only return one hit for every id
(in the best case by preference of the ordering of the indices of the
request).

What I would need is:

  • search over index1,index2:
    return 2 matches: docid1[index1], docid2[index2].

  • search over index2,index1:
    return 2 matches: docid1[index2], docid2[index2].

I didn't find the description of a similar behavior in the documents.

Regards,
Michel

--

Not possible in Elasticsearch (at least I don't think so). The id only
grants uniqueness in a specific index. How many indices to you have?
Can you implement it on the client side?

--
Ivan

On Thu, Sep 6, 2012 at 2:50 AM, Michel Conrad
michel.conrad@trendiction.com wrote:

Hi,
is it currently possible to search over multiple indices and only
return one hit for every id?

I have the following situation:
index1 holds docid1
index2 holds docid1 and docid2.

When I search over indices index1,index2 I get 3 matches
docid1[index1], docid1[index2], docid2[index2].

My question is if it is possible to only return one hit for every id
(in the best case by preference of the ordering of the indices of the
request).

What I would need is:

  • search over index1,index2:
    return 2 matches: docid1[index1], docid2[index2].

  • search over index2,index1:
    return 2 matches: docid1[index2], docid2[index2].

I didn't find the description of a similar behavior in the documents.

Regards,
Michel

--

--