I have a RESTful API that I have uncovered utilizing an execution of Elasticsearch on an EC2 occasion to list a corpus of substance. I can question the search by executing the accompanying from my terminal (MacOSX):
curl -XGET 'http://ES_search_demo.com/document/record/_search?pretty=true' -d '{
"query": {
"bool": {
"must": [
{
"text": {
"record.document": "SOME_JOURNAL"
}
},
{
"text": {
"record.articleTitle": "farmers"
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 50,
"sort": [],
"facets": {}
}'
How would I transform the above into an API request utilizing python/requests or python/urllib2 (not certain which one to go for - have been utilizing urllib2, yet hear that solicitations is better...)? Do I pass as a header or something else?