I need to index document in SOLR using SOLR rest API I am able to read data from SOLR.I am working on ASP.NET application and from client side I need to push data into SOLR any inputs regarding the same will be highly appreciated
var pubId = '[{Message: "sdsdfsdfsfdfsddffdfd",TimeStamp: "18/5/2017 14:52:51",MessageId: "dsdsdd",id: "141ddd11d52151",User: "DEMOUser"}]';
$.ajax({
crossDomain: true,
type: "POST",
url: "http://1.1.1.1:8984/solr/core1/update?commit=true&boost=1.0&commitWithin=1000&overwrite=true&wt=json",
data: JSON.stringify(pubId),
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
jsonp: 'json.wrf',
jsonpCallback: 'callback',
success: function (response) {
if (1 < 2) {
$('#txtmessage').val("");
var currentdate = new Date();
var datetime = currentdate.getDate() + "/"
+ (currentdate.getMonth() + 1) + "/"
+ currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
//$("#messagesend").append('<li class="left clearfix"></div><span class="chat-img1 pull-left"><span class="glyphicon glyphicon-user"></span></span>' + user + '<p>' + response + '</p><div class="chat_time pull-right">' + param2 + '</div></div></li>')
}
else {
}
},
failure: function (response) {
alert(response.responseText);
},
error: function (response) {
alert(response.responseText);
}
});
Question Updated I don't get any error the service response is fine but when i check in SOLR there is no new data index.enter image description here]1
I have enabled the cross-origin
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<init-param>
<param-name>allowedOrigins</param-name>
<param-value>http://localhost*</param-value>
</init-param>
<init-param>
<param-name>allowedMethods</param-name>
<param-value>GET,POST,DELETE,PUT,HEAD,OPTIONS</param-value>
</init-param>
<init-param>
<param-name>allowedHeaders</param-name>
<param-value>origin, content-type, cache-control, accept, options, authorization, x-requested-with</param-value>
</init-param>
<init-param>
<param-name>supportsCredentials</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>chainPreflight</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>