POST json request for Solr with cursorMark request

Is it possible to include cursorMark value in the body of the POST request instead of sending it as a parameter of the query string?

The following query:

 {"query":"val:abc","limit":10,"cursorMark":"*","sort":"id asc"} 

returns the error message: "Unknown top-level key in JSON request: cursorMark"

+5
source share
1 answer

According to the Solr Json request API documentation , each request line parameter has a corresponding POST request parameter in the JSON API, for example q โ†’ query, start โ†’ offset, etc.

However, there is no equivalent parameter for the cursorMark query string parameter.

The best solution that I know of is to change the request type from the / json application to application / x-www-form-urlencoded, which allows you to use the query string parameters in the body of the POST request. The reason I used the / json application was to get a json response, but it turns out that it is controlled by the wt = json parameter.

  • Changed uri request: http: // localhost: 8983 / solr / myCore / select? Wt = json
  • The parameters of the POST request are changed back to the query string instances, i.e. q, start, strings, etc.
  • UrlEncoded query string.
  • Put the encoded request string in the POST body.
  • The request content type for the application / x -www-form-urlencoded has been changed.
+3
source

Source: https://habr.com/ru/post/1263742/


All Articles