You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by "zhtao01@163.com" <zh...@163.com> on 2021/12/24 03:19:39 UTC

parameter length limit of GET query

Hi,
    I would like to know the parameter length limit of a GET request,as I found the following exception is throwed if the parameter over some length:
        Exception in thread "main" org.apache.http.ParseException: Invalid content type: 
        at org.apache.http.entity.ContentType.parse(ContentType.java:273)
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:591)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:255)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:244)
at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:194)
at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:974)
at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:990)

      Is it possible to expand the limit by some configurations in Solr?

      Many thanks.
      Tony

Re: parameter length limit of GET query

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/23/2021 8:19 PM, zhtao01@163.com wrote:
>      I would like to know the parameter length limit of a GET request,as I found the following exception is throwed if the parameter over some length:

What I would strongly recommend is switching to a POST request, and put 
the parameters that would normally go on the URL in the request body. 
Solr's default limit for POST request bodies is 2 megabytes.  Which can 
be increased.

The jetty server that actually runs Solr defaults to a header length 
limit of 8192 bytes.  The entire GET request line must be below that, or 
the request won't work.  You can increase this by changing something in 
server/etc/jetty.xml:

     <Set name="requestHeaderSize"><Property 
name="solr.jetty.request.header.size" default="8192" /></Set>

Change the number on that line and restart Solr.

If you have changed Solr to use https, I think the active config will be 
jetty-ssl.xml ... and if so, you will need to add some config to it so 
it looks like jetty.xml and has the config for the request header size.

All this assumes you're using a recent version of Solr.

Thanks,
Shawn