when Iam posting json object to apache solr 6 while indexing through java code Iam getting error as below:
the error message is as below:
"{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],"msg":"[doc=null] missing required field: id","code":400}}"
and my json object is as below:
"_childDocuments_" :[
{
"entityname": "ReportDuplicate"
}
],
"_childDocuments_" :[
{
"entityname": "LinkedReport"
}
],
"_childDocuments_" :[
{
"entityname": "Source"
}
],
"_childDocuments_" :[
{
"entityname": "Literature",
"_childDocuments_" :[
{
"entityname": "Authors"
}
]
}
],
"_childDocuments_" :[
{
"entityname": "AdditionalInformation"
}
],
And my java code to post the json object is as below:
org.apache.http.client.HttpClient client = HttpClientBuilder.create().build();
HttpPost post = new HttpPost("http://localhost:8983/solr/icsr/update/json?wt=json&commit=true");
StringEntity entity = new StringEntity("{\"add\": { \"doc\":"+value+" }}", "UTF-8");
entity.setContentType("application/json");
post.setEntity(entity);
HttpResponse response = client.execute(post);
HttpEntity httpEntity = response.getEntity();
InputStream in = httpEntity.getContent();
String encoding = httpEntity.getContentEncoding() == null ? "UTF-8" : httpEntity.getContentEncoding().getName();
encoding = encoding == null ? "UTF-8" : encoding;
String responseText = IOUtils.toString(in, encoding);
System.out.println("response Text is " + responseText);
Im using solr 6 server to index the data from java code : As im geeting bad HTTP request while debugging and Im new to solr, And no changes are done in managed-schema.xml file : thansk in advance