I have done a JSONDocMgr.write(docId, handle); in my java application. The json data is loaded from a file. I can see my document in http://localhost:8000/qconsole/, but the case is that I need to use REST services to query the DB. The docId is /books/text.json, when I try to do a GET using postman http://localhost:8000/books/search?q=harry I'm getting Page Not Found. Can someone please help me on this.
1 Answer
To get your document via REST see /v1/documents. For example:
curl -i --digest --user myuser:mypwd -X GET \
'http://localhost:8000/v1/documents?uri=/books/text.json'
To search documents via REST see /v1/search. For example:
curl -i --digest --user myuser:mypwd -X GET \
'http://localhost:8000/v1/search?q=harry'
Make sure the port and username you use for REST matches the port and username you use in Java.
3 Comments
RapTor
I see that localhost:8000/v1/search?q=harry searches the entire document list, can I be more specific about the document it searches for?
Dave Cassel
Yes, that endpoint lets you write lots of different types of queries. See Using and Configuring Query Options in the REST API Guide for more information.
Dave Cassel
Also, you can use the Java Client API to read your document and do searches.