Jermakki
Jermakki

Reputation: 41

How to retrieve custom properties of Solr cores

I'm bit new with Solr 7.0.

With Solr CoreAdmin APIs it is possible to create new cores with custom properties:

solr/admin/cores?action=CREATE&name=mycore&configSet=myconfigset&property.version=1.2.3

The command above creates a new core with a core.properties file containing the specified custom property "version" with value "1.2.3"

The defined custom properites may be used as replacement in Solr configuration files, but I could not be able to retrieve (and eventually update) a specific custom property using the Solr CoreAdmin APIs.

How is it possible to retrive or update a specific core custom property?

Thanks a lot

Upvotes: 2

Views: 279

Answers (1)

Sanjay Dutt
Sanjay Dutt

Reputation: 2222

To create user defined property, you can use below command.

curl http://localhost:8983/solr/<core-name>/config -H'Content-type:application/json' -d '{
    "set-user-property" : {"custom_property":"some_value"}}'

And, to retrieve it. curl http://localhost:8983/solr//config/overlay?omitHeader=true

Though, these properties will be removed, once you have restarted the server. So I would suggest you to add these properties in core.properties file.

For more information :- https://lucene.apache.org/solr/guide/6_6/config-api.html#ConfigAPI-CreatingandUpdatingUser-DefinedProperties

Upvotes: 2

Related Questions