How to get the link of pdf in json response


I am integrating FESS results in my wordpress site.
I used this Search API in order to get results:


I was able to get results. Using the json response i create a search result list display in my Wordpress website using a custom plugin. I want that when the user click the pdf file result, its behavior will be similar with FESS search results, it will open the pdf file. However I cannot find the link to be used for that in json response:

Sample json response:
“data”: [
“filetype”: “pdf”,
“title”: “This is a test PDF document”,
“content_title”: “This is a test \u003Cstrong\u003EPDF\u003C/strong\u003E document”,
“digest”: “This is a test PDF document. If you can read this, you have Adobe Acrobat Reader installed on your computer. D:20010829095457 Acrobat Distiller 4.05 for Windows Gene Brumblay This is a test PDF doc…”,
“host”: “localhost”,
“last_modified”: “2024-04-24T07:33:10.456Z”,
“content_length”: “3908”,
“timestamp”: “2024-04-24T07:33:10.456Z”,
“url_link”: “file://data/guest/test.pdf”,
“created”: “2024-05-13T01:41:47.916Z”,
“site_path”: “/data/guest/test.pdf”,
“doc_id”: “639f962c9cf242e498c2c087225f5d49”,
“url”: “file:/data/guest/test.pdf”,
“content_description”: “This is a test \u003Cstrong\u003EPDF\u003C/strong\u003E document. If you can read this, you have Adobe…Gene Brumblay This is a test \u003Cstrong\u003EPDF\u003C/strong\u003E document Microsoft Word 9.0 …”,
“site”: “/data/guest/test.pdf”,
“filename”: “test.pdf”,
“boost”: “1.0”,
“mimetype”: “application/pdf”,
“_id”: “d0fb066155cdcd24c88ae0a2668992a7577f16b87c0faa59c3edd36fa052bcd260ebd886d64e42a35eb4aacee0a318f84873d5892658c17ae8e6df80015c3e42”

In FESS search, it has link like this:
<a class="link" href="/go/?rt=1715567151545&amp;docId=639f962c9cf242e498c2c087225f5d49&amp;queryId=9e27811ab1a84f47a8b67458ac77c11e&amp;order=0" data-uri="file://data/guest/test.pdf" data-id="639f962c9cf242e498c2c087225f5d49" data-order="0">This is a test <strong>PDF</strong> document</a>

From the json response, i can only see the documentId. Is there a way I could get the link that will open the pdf, or even just download. Thank you.

You can create a go link as follows.
Replace the value of queryId with query_id from the API response, and docId with doc_id:

curl "http://localhost:8080/go/?rt=$(date +%s)&queryId=...&docId=..."
1 Like