【问题标题】:Update Solr index by http request通过 http 请求更新 Solr 索引
【发布时间】:2013-09-29 20:32:45
【问题描述】:

假设我们有以下索引结构:

    <field name="id" type="string" indexed="true" stored="true" required="true" />
    <field name="user" type="string" indexed="true" stored="true"/>

我们想向这个索引添加一个值。在cookbook4中它是通过这样的命令完成的

curl 'localhost:8983/solr/update?commit=true' -H 'Contenttype: 应用程序/json' -d '[{"id":"1","user":{"add":"jack"}}]'

如何通过传递 http 请求从 java 代码中为索引添加值?

【问题讨论】:

    标签: curl solr


    【解决方案1】:

    由于您想从 Java 代码执行此操作,您可能会考虑查看 Solr Java 客户端 SolrJ。或者,如果您只想传递纯 http 请求而不使用 SolrJ 客户端,您可以传递多种格式的 http 请求正文。以下是用于发送 XML 或 JSON 的链接

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-16
      • 2012-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多