title: URL encode cURL parameters for Elasticsearch
body: <p>I would like to make cURL/Elasticsearch understand HTTP query parameters passed as normal strings while being url encoded by the command.</p>
  
  <p>If I run this HTTP GET via <code>cURL</code> to submit the query to Elasticsearch:</p>
  
  <pre><code>curl \
    -H 'Content-Type: application/json' \
    -XGET '127.0.0.1:9200/movies/movie/_search?q=%2Byear%3A%3E1980+%2Btitle%3Astar%20wars&amp;pretty'
  </code></pre>
  
  <p>Then I am able to retrieve the expected documents.</p>
  
  <p>However if I run this <code>cURL</code> query:</p>
  
  <pre><code>curl \
     -H 'Content-Type: application/json' \
     --data-urlencode "pretty" \
     --data-urlencode "q=+year:&gt;1980 +title:star wars&amp;pretty" \
     -XGET '127.0.0.1:9200/movies/movie/_search'
  </code></pre>
  
  <p>Then I get this error:</p>
  
  <pre><code>{
      "error": {
          "root_cause": [{
              "type": "json_parse_exception",
              "reason": "Unrecognized token 'pretty': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@7856627; line: 1, column: 8]"
          }],
          "type": "json_parse_exception",
          "reason": "Unrecognized token 'pretty': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@7856627; line: 1, column: 8]"
      },
      "status": 500
  }
  </code></pre>
  
  <p>I am using:</p>
  
  <ul>
  <li><code>cURL</code> version 7.47.0 which should understand the command parameter <code>--data-urlencode</code></li>
  <li>Elasticsearch 6.3.1</li>
  </ul>