Reputation: 2664
My requirement is to send a search query to the Solr server through a Rest API and retrieve results.
Is there a facility to send search queries using a Rest API?
If the non-rest query is field1:name1
, what should the body of the JSON would be? (assuming there exist such a facility in Solr)
Upvotes: 0
Views: 6847
Reputation: 52832
Depending on what you mean by "through a Rest API", all queries are by default submitted through a standard HTTP query interface. Query /solr/corename/select?q=field1:name1
to retrieve documents matching the query. You can rename select
if you want it to match a more REST-ish naming scheme, such as /documents.
.. so it kind of depends on what your definition of a "Rest API" is.
There is way of making query requests through a content stream. If you don't want to use regular GET
arguments (?q=field:foo&fq=field2:foo2
), you can make a POST request (and for very extensive queries, that might be necessary) instead.
Upvotes: 2