You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2022/08/30 22:22:17 UTC

Re: SOLR API - modifying the schema for one collection modifies it for ALL collections ?

Jan, Serban,

On 5/3/22 19:09, Jan Høydahl wrote:
> Your Collection's schema is part of a ConfigSet (https://solr.apache.org/guide/8_11/config-sets.html <https://solr.apache.org/guide/8_11/config-sets.html>).
> Multiple collections may use the same ConfigSet.
> The gotcha is that when you modify schema for collection A, what you really do is modify the schema in the ConfigSet for collection A.
> IMO the schema API should have been part of configset api to clarify this.
> 
> You can get around this by clone your ConfigSet and create the new collection using the cloned copy.

I've been playing-around with trying to programmatically alter the 
schema for a Solr core as well, and this explains a LOT of weirdness I 
was experiencing.

Jan, thanks for explaining the root problem, but your solution of just 
"cloning your Configset" doesn't offer much detail. How does one clone a 
config set? How does one USE a Configset? What if you need to delete a 
configSet to start-over?

Thanks,
-chris

>> 3. mai 2022 kl. 17:22 skrev Serban Alexe <se...@gmail.com>:
>>
>> Hi all,
>>
>> I have a SOLR Server with several collections.
>>
>> To retrieve the properties of the fields, I ran these requests:
>>
>>    - GET http://localhost:8983/solr/<collection_id_1>/schema/fields
>>    - GET http://localhost:8983/solr/<collection_id_2>/schema/fields
>>
>> Then I ran a POST http://localhost:8983/solr/<collection_id_1>/schema
>> request, with the content needed to change some fields properties.
>>
>> After this, I noticed that *the same fields properties changes were also
>> modified for* collection_id_2.
>>
>> Is this normal behaviour ?
>> What did I do wrong ?
>> Thank you.
>>
>> --
>> Şerban Alexe
> 
> 

AW: SOLR API - modifying the schema for one collection modifies it for ALL collections ?

Posted by Andreas Mock <an...@drumedar.de>.
Hi Chris,

it is the same I struggled with when I started with Solr.

The ConfigSet is a set of configuration you refer to with one or more cores.
Changing settings for the core changes the ConfigSet, therefore the setting
for all cores refering that ConfigSet.

Solution: Make a full copy of a ConfigSet, when you want to change settings
for a core individually. 
We decided to keep one ConfigSet as a kind of default, not refered by any core.
It is THE template keeping all ConfigSet changes valid for all cores we have.
We copy that template and apply as much config changes programatically
as possible to that base ConfigSet. If we have to "rollback", we delete the core,
we delete the ConfigSet (directory), copy the default ConfigSet, add the core,
apply all config changes programatically.

I hope this helps what "cloning" means.

Regards
Andreas


-----Ursprüngliche Nachricht-----
Von: Christopher Schultz <ch...@christopherschultz.net> 
Gesendet: Mittwoch, 31. August 2022 00:22
An: users@solr.apache.org; Jan Høydahl <ja...@cominvent.com>
Betreff: Re: SOLR API - modifying the schema for one collection modifies it for ALL collections ?

Jan, Serban,

On 5/3/22 19:09, Jan Høydahl wrote:
> Your Collection's schema is part of a ConfigSet (https://solr.apache.org/guide/8_11/config-sets.html <https://solr.apache.org/guide/8_11/config-sets.html>).
> Multiple collections may use the same ConfigSet.
> The gotcha is that when you modify schema for collection A, what you really do is modify the schema in the ConfigSet for collection A.
> IMO the schema API should have been part of configset api to clarify this.
> 
> You can get around this by clone your ConfigSet and create the new collection using the cloned copy.

I've been playing-around with trying to programmatically alter the schema for a Solr core as well, and this explains a LOT of weirdness I was experiencing.

Jan, thanks for explaining the root problem, but your solution of just "cloning your Configset" doesn't offer much detail. How does one clone a config set? How does one USE a Configset? What if you need to delete a configSet to start-over?

Thanks,
-chris

>> 3. mai 2022 kl. 17:22 skrev Serban Alexe <se...@gmail.com>:
>>
>> Hi all,
>>
>> I have a SOLR Server with several collections.
>>
>> To retrieve the properties of the fields, I ran these requests:
>>
>>    - GET http://localhost:8983/solr/<collection_id_1>/schema/fields
>>    - GET http://localhost:8983/solr/<collection_id_2>/schema/fields
>>
>> Then I ran a POST http://localhost:8983/solr/<collection_id_1>/schema
>> request, with the content needed to change some fields properties.
>>
>> After this, I noticed that *the same fields properties changes were 
>> also modified for* collection_id_2.
>>
>> Is this normal behaviour ?
>> What did I do wrong ?
>> Thank you.
>>
>> --
>> Şerban Alexe
> 
> 

Re: SOLR API - modifying the schema for one collection modifies it for ALL collections ?

Posted by Shawn Heisey <ap...@elyograg.org.INVALID>.
On 8/30/22 16:22, Christopher Schultz wrote:

> I've been playing-around with trying to programmatically alter the 
> schema for a Solr core as well, and this explains a LOT of weirdness I 
> was experiencing.
>
> Jan, thanks for explaining the root problem, but your solution of just 
> "cloning your Configset" doesn't offer much detail. How does one clone 
> a config set? How does one USE a Configset? What if you need to delete 
> a configSet to start-over?

The answer may be different depending on whether you're in cloud mode or 
standalone mode.

In standalone, the configsets are on the disk, in 
${solr.solr.home}/configsets.  In cloud mode, they are in zookeeper.

If you're using the API to modify something, that distinction probably 
doesn't matter.  But it probably does matter when it comes to creating a 
new configset.  collection.  The configset must be in place before it 
can be used in a core/collection creation.  For SolrCloud, configset 
manipulation is possible using the API, but I don't think it's possible 
in standalone.

https://solr.apache.org/guide/solr/latest/configuration-guide/configsets-api.html

Thanks,
Shawn