Reply
New Contributor
Posts: 3
Registered: ‎06-29-2017

How to prgramatically index doc?

I use Solr 4.10.3 CHD 5.11.0. I successfully setup solr and can create a schemaless collection where doc updated through flume + morphline + solr or through solr web ui may look like

 

"docs": [
      {
        "content": [
          "Flume Developer Notes\n=====================\n\n//...
        ],
        "id": "067dd8ac-82fa-461a-9c1d-3b6a7d7ff1f4",
        "content_encoding": [
          "ISO-8859-1"
        ],
        "content_type": [
          "text/plain; charset=ISO-8859-1"
        ],
        "meta": [
          "_attachment_mimetype",
          "text/plain",
          "Content-Encoding",
          "ISO-8859-1",
          "_attachment_body",
          "[B@759c28e5",
          "Content-Type",
          "text/plain; charset=ISO-8859-1"
        ],
        "_version_": 1571534977234894800
      },

Now I want to index doc programatically by solr 4.10.3-cdh5.11.0. The code looks like 

  val client = {
    val solr = new CloudSolrServer ("localhost:2181/solr")
    solr.setDefaultCollection("log_col")
    solr.connect
    solr
  }
  ...
  val request = new UpdateRequest
  request.setAction(ACTION.COMMIT, true, true);
  request.setCommitWithin(time.toMillis.toInt)
  val collection = client.getDefaultCollection
  request.setParam("collection", collection)
  request.add(docs.asJava)
  //client.request(request)
  request.process(client)

However at runtime it throws 

Caused by: org.apache.solr.common.cloud.ZooKeeperException: Could not find configName for collection log_col found:[managedTemplateSecure, predefinedTemplateSecure, predefinedTemplate, managedTemplate, schemalessTemplate, schemalessTemplateSecure]

How to fix this error?

 

Thanks

 

Announcements