Hi,

I wanted to test the error message that Solr returns when indexing a
document with an unknown field. Surprisingly, I get different errors,
depending if the request hits the shard's leader or not.

To reproduce (5.3.1):

bin/solr -e cloud
  ports: 8983, 7574
  config: basic_configs
  shards: 1
  replicas: 2

Wait for the nodes to come up and issue a CLUSTERSTATUS call to check which
replica is the leader. In my case, 7574 was the leader. Now index a
document with an unknown field:

curl -i -X POST http://localhost:8983/solr/gettingstarted/update/json -d
'[{"id" : "1", "unknown" : "foo"}]'

And you get back

{"responseHeader":{"status":400,"QTime":6},"error":{"msg":"Bad
Request\n\n\n\nrequest:
http://169.254.21.228:7574/solr/gettingstarted_shard1_replica1/update?update.distrib=TOLEADER&distrib.from=http%3A%2F%2F169.254.21.228%3A8983%2Fsolr%2Fgettingstarted_shard1_replica2%2F&wt=javabin&version=2
","code":400}}

But if you execute:

curl -i -X POST http://localhost:7574/solr/gettingstarted/update/json -d
'[{"id" : "1", "unknown" : "foo"}]'

Then you get back

{"responseHeader":{"status":400,"QTime":1},"error":{"msg":"ERROR: [doc=1]
unknown field 'unknown'","code":400}}

In both cases you get back 400, but if the request hits the leader you get
a more expressive error message. Is there any reason for that behavior?
Can't the replica just pass along the error that it got from the leader?

Shai

Reply via email to