Search code examples
solrapache-zookeepersolrcloud

Solr7 using old schema.xml


We setup external Zookeper with 3 nodes and 3 Solr 7 instances.

I am trying to use schema.xml file from my old project created using Solr 4.

I follow bellow steps :

  1. Rename the managed-schema file to schema.xml.

  2. Modify solrconfig.xml to replace the schemaFactory class.

    a. Remove any ManagedIndexSchemaFactory definition if it exists.

    b. Add a ClassicIndexSchemaFactory

uploaded configuration using upconfig

sudo ./zkcli.sh -cmd upconfig -confdir /home/pc2/Desktop/solrconfig/conf-readData -confname readData -zkhost 192.168.1.120:2181,192.168.1.100:2181,192.168.1.105:2181

sudo ./zkcli.sh -cmd linkconfig -collection readData -confname readData -zkhost 192.168.1.120:2181,192.168.1.100:2181,192.168.1.105:2181

curl 'http://192.168.1.85:8983/solr/admin/collections?action=CREATE&name=readData&numShards=3&replicationFactor=3&maxShardsPerNode=3'

When I check schema for readData from Solr admin, it is not showing fields that I mentioned in schema.xml.

Fields created were _root_, _text_, _version_ and many more dynamic fields.

What I am missing?

  • Solr version: 7.3.0

  • Zookeper version: 3.4.12


Solution

  • I see 2 problems in what you do:

    1. The collection.configName parameter is missing when you create the collection.

    2. You must first create the collection and than link the configuration.

    linkconfig is useful when you want change the current configuration with a new one, but you must specify the collection.configName parameter while creating a new collection or, on the other hand, the _default collection config is used.

    This also explains why you see only _root_, version, _text_, etc. Those are the default fields configured in the _default collection configuration.

    I suggest to create the collection in the following way:

    curl "http://192.168.1.85:8983/solr/admin/collections?action=CREATE&name=readData&collection.configName=readData&numShards=3&replicationFactor=3&maxShardsPerNode=3"
    

    Or use the Solr admin console.