You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Richard Jones <bm...@gmail.com> on 2019/07/22 19:19:17 UTC

/get handler on simple collection alias only checking first collection in list

On 8.1.1 and 7.7.2 I have a simple collection alias where /select is
working as expected, but /get is only checking the first underlying
collection for documents.

Is this expected behaviour?

My routing field is a string so I cannot use complex routing for
aliases. I wanted to see if it's a known bug or a known feature.

Steps to reproduce :

Create the collections :

$ /opt/solr/bin/solr create_collection -c first
...
Created collection 'first' with 1 shard(s), 1 replica(s) with config-set 'first'
$ /opt/solr/bin/solr create_collection -c second
...
Created collection 'second' with 1 shard(s), 1 replica(s) with
config-set 'second'

Create the alias :

$ curl 'localhost:8983/solr/admin/collections?action=CREATEALIAS&name=simplealias&collections=first,second'
{
  "responseHeader":{
    "status":0,
    "QTime":133}}

Insert the test documents :

$ curl -d '[{"id":"1","site":"first"}]'
'localhost:8983/solr/first/update?commit=true' -H
"content-type:application/json"
{
  "responseHeader":{
    "rf":1,
    "status":0,
    "QTime":235}}
$ curl -d '[{"id":"2","site":"second"}]'
'localhost:8983/solr/second/update?commit=true' -H
"content-type:application/json"
{
  "responseHeader":{
    "rf":1,
    "status":0,
    "QTime":163}}

Select from the alias :

$ curl 'localhost:8983/solr/simplealias/select/?q=*:*'
{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":58,
    "params":{
      "q":"*:*"}},
  "response":{"numFound":2,"start":0,"maxScore":1.0,"docs":[
      {
        "id":"1",
        "site":["first"],
        "_version_":1639785169851252736},
      {
        "id":"2",
        "site":["second"],
        "_version_":1639785186243641344}]
  }}

Get from the first underlying collection :

$ curl 'localhost:8983/solr/simplealias/get?id=1'
{
  "doc":
  {
    "id":"1",
    "site":["first"],
    "_version_":1639785169851252736}}

Get from the second underlying collection :

$ curl 'localhost:8983/solr/simplealias/get?id=2'
{
  "doc":null}

Specifying the shard of the second collection yields a result,
indicating this is a routing issue? :

$ curl 'localhost:8983/solr/simplealias/get?id=2&debug=all&shards=http://10.1.0.128:8983/solr/second_shard1_replica_n1/'
{
  "doc":
  {
    "id":"2",
    "site":["second"],
    "_version_":1639785186243641344}}


Thanks,
Rich