Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for search query strings #19

Open
sozoalvin opened this issue Jun 1, 2021 · 1 comment
Open

API for search query strings #19

sozoalvin opened this issue Jun 1, 2021 · 1 comment

Comments

@sozoalvin
Copy link

Hello, the general API instructions seems to be missing a section on how search queries can be made through REST API.

Are there some general (or detailed) instructions I could follow to make API calls to the bleve server/ index and have the results sent back as json?

Hope this is not too much trouble.

@mschoch
Copy link
Contributor

mschoch commented Jun 1, 2021

According to the README, the API call to search the index is:

POST /api/{indexName}/_search - search index

I would recommend you run bleve-explorer, open up the web interface in your browser, and when you run a search, use the developer console to examine the JSON request/response. I believe it simply uses the bleve default HTTP handler, which we can see here using the bleve.SearchRequest, which has JSON struct tag annotations.

HTTP Handler parsing as http.SearchRequest:
https://github.com/blevesearch/bleve/blob/eaa32627cedbf3c7f66451aea5b86d5a0a7876e4/http/search.go#L65

bleve.SearchRequest:
https://github.com/blevesearch/bleve/blob/eaa32627cedbf3c7f66451aea5b86d5a0a7876e4/search.go#L271-L286

bleve.SearchResult:
https://github.com/blevesearch/bleve/blob/eaa32627cedbf3c7f66451aea5b86d5a0a7876e4/search.go#L488-L496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants