Return name of the collection/core with the document

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Return name of the collection/core with the document

ufuk yılmaz
Is it possible to return which collection a matching document came from, when querying against an alias?

Suppose alias “myAlias” is pointing to collections c1, c2 and c3 and we are querying:

/solr/myAlias?q=id:123

I’m trying to get a response similar to:

[{ “id”: 123, “collection”: “c2”}]

Core name, shard name would be useful too, since I can extract collection name from them.

Is this achievable?

Thanks
~ufuk

Sent from Mail for Windows 10

Reply | Threaded
Open this post in threaded view
|

Re: Return name of the collection/core with the document

Jan Høydahl / Cominvent
Try to add shards.info=true to your request, and you should get the core name in the response..

Jan

> 10. jun. 2021 kl. 23:55 skrev ufuk yılmaz <[hidden email]>:
>
> Is it possible to return which collection a matching document came from, when querying against an alias?
>
> Suppose alias “myAlias” is pointing to collections c1, c2 and c3 and we are querying:
>
> /solr/myAlias?q=id:123
>
> I’m trying to get a response similar to:
>
> [{ “id”: 123, “collection”: “c2”}]
>
> Core name, shard name would be useful too, since I can extract collection name from them.
>
> Is this achievable?
>
> Thanks
> ~ufuk
>
> Sent from Mail for Windows 10
>

Reply | Threaded
Open this post in threaded view
|

RE: Return name of the collection/core with the document

ufuk yılmaz
I tried it but shards.info returned all shard information of all collections in the alias, not just where the document came from. I still don’t know which collection the response docs came from.

Sent from Mail for Windows 10

From: Jan Høydahl
Sent: 11 June 2021 12:44
To: [hidden email]
Subject: Re: Return name of the collection/core with the document

Try to add shards.info=true to your request, and you should get the core name in the response..

Jan

> 10. jun. 2021 kl. 23:55 skrev ufuk yılmaz <[hidden email]>:
>
> Is it possible to return which collection a matching document came from, when querying against an alias?
>
> Suppose alias “myAlias” is pointing to collections c1, c2 and c3 and we are querying:
>
> /solr/myAlias?q=id:123
>
> I’m trying to get a response similar to:
>
> [{ “id”: 123, “collection”: “c2”}]
>
> Core name, shard name would be useful too, since I can extract collection name from them.
>
> Is this achievable?
>
> Thanks
> ~ufuk
>
> Sent from Mail for Windows 10
>