How do I search in multiple fields with ElasticSearch and a CURL request?
The params in the URI need to be urlencoded and should not include the escaped double quotes.
For example the query in OP should be :
curl -XGET 'http://localhost:9200/foo/_count?q=user%3Afoo%20AND%20posts%3Abar&pretty=true