如何通过c++中的应用程序将数据插入solr

How do I insert data into solr through my application which is in c++

本文关键字:数据 插入 solr 应用程序 何通过 c++      更新时间:2023-10-16

我想通过我的应用程序将数据插入solr,我也在使用弹性搜索来存储数据,将数据插入到弹性搜索中我正在使用以下请求,将我的数据包括在索引"16-03-2016-sslindex"中:

"POST http://192.168.0.164:9200/_bulk HTTP/1.1
Host: 192.168.0.164:9200
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;)
Pragma: no-cache
Content-Type: application/x-www-form-urlencoded
Content-Length: 196"
"{"index":{"_index": "16-03-2016-sslindex","_type":"session"}}
{"UniqueID":"2016-3-16-10-45-19-1-1","Time":"2016-3-16T10:45:19","SrcIp":"192.168.0.180","SrcPort":1123,"DstIp":"74.125.68.113","DstPort":443,"InterfaceID":"1","LocationID":2,"Size":0,"Snortname":"p_snort.log.123","Dummy1":"","Dummy2":0}"

我想以同样的方式使用solr。请求结构应该是什么,以便在solr中插入valye。

Solr支持用于插入/更新/搜索的HTTP协议
你必须点击Solr(再次通过套接字编程。)

在Java中

public void pumpData() {
// hit elastic cloud
// then hit solr
}

(仅供参考:Solrj是一个访问solr的java客户端。它使任务变得不那么容易。)

你在C++中也必须这样做。C++有"SolrCp"solr客户端-SolrCpp
Apache站点提到了相同的solr客户端