0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Solr 9 で Stream Body を有効にする

Last updated at Posted at 2023-08-29

現象

Solr 9 にて stream body を使うAPIを利用しようとすると以下のエラーが発生する。

{
  "error":{
    "metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],
    "msg":"Stream Body is disabled. See https://solr.apache.org/guide/solr/latest/configuration-guide/requestdispatcher.html for help",
    "code":400
  }
}

また、Solr 8 までの対応方法(solrconfig.xmlを編集する)でもエラーになる。

<requestParsers multipartUploadLimitInKB="-1"
    enableRemoteStreaming="true"
    enableStreamBody="true"
    formdataUploadLimitInKB="-1"
    addHttpRequestToContext="false"/>

原因

Solr9 では仕様が変更になっている。

Use of stream.file, stream.url and stream.body params are no longer enabled via configuration in solrconfig.xml, nor dynamic equivalents with the config API. Older configuration now does nothing. Instead, set an env var: SOLR_ENABLE_REMOTE_STREAMING or SOLR_ENABLE_STREAM_BODY or system property equivalents.

stream.file、stream.url、およびstream.bodyの各パラメータは、solrconfig.xmlのコンフィギュレーションや、コンフィギュレーションAPIを使用した動的な同等のコンフィギュレーションでは使用できなくなりました。古い設定は何もしません。代わりに、env varを設定します: SOLR_ENABLE_REMOTE_STREAMINGまたはSOLR_ENABLE_STREAM_BODY、または同等のシステムプロパティを設定してください。

対応

で、環境変数(SOLR_ENABLE_REMOTE_STREAMING, SOLR_ENABLE_STREAM_BODY)に何の値を設定するのかは書いてないように見えましたが、起動のシェルを見たらみつかりました。

環境変数(SOLR_ENABLE_REMOTE_STREAMING, SOLR_ENABLE_STREAM_BODY)に "true" をセットします。

SOLR_ENABLE_REMOTE_STREAMING=true
SOLR_ENABLE_STREAM_BODY=true

まとめ

Solr 9 で Stream Body を有効にするには環境変数(SOLR_ENABLE_REMOTE_STREAMING, SOLR_ENABLE_STREAM_BODY)に "true" をセットします。


以上です。

参考

OpenAI の embedding API の結果を Solr 9 に格納することも可能です。

関連するかもしれない記事 (Solr 9.x )

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?