Search ElasticSearch via GET using JSON
Anyone know of a way to send a JSON query to an ElasticSearch server via HTTP GET? I know you can POST the JSON content to _search, but POST is not available because this is cross-domain. For example, if my query looks like this:
{
"query": {
"query_string": {
"fields": ["name", "description"],
"query": "Elastic Search"
}
}
}
Which I would convert to something like:
{"query":{"query_string":{"fields":["name","description"],"query":"Elastic Search"}}}
Is there a way to GET server:9200/index/type/_search?content=stringifiedquery or something similar? I've tried q= and content= as well开发者_JAVA技巧 as just passing the content after the ? but nothing seems to work. Anyone have any ideas? Or am I just out of luck?
You can use the source
query string parameter to send what would normally be the post body.
See the bottom of this page: http://www.elasticsearch.org/guide/reference/api/
精彩评论