anoop
anoop

Reputation: 1614

How to insert multiple index at a time on a solr update using json

I have refer different related web page for getting how can i post multiple index to solr in a single request. I have gone through the solr link http://wiki.apache.org/solr/UpdateJSON#Example but the link explain feature not that much clearly.

Also i have found that create a json like this:

{
    "add": {"doc": {"id" : "TestDoc1", "title" : "test1"} },
    "add": {"doc": {"id" : "TestDoc2", "title" : "another test"} }
}

can solve the issue. But in this case only last index is updated/inserted to index. My project is a java project. Please help me on this.

Upvotes: 0

Views: 1031

Answers (1)

MatsLindh
MatsLindh

Reputation: 52802

The JSON module support using the regular JSON array notation (from 3.2 and forward). If you're adding documents, there is no need for the "add" key either:

[
  {
    "id" : "MyTestDocument",
    "title" : "This is just a test"
  },
  {
    "id" : "MyTestDocument2",
    "title" : "This is antoher test"
  }
]

Upvotes: 1

Related Questions