title: ElasticSeach - Sorting on dates
body: <p>I have an elastic search index which I cannot setup every field with a mapping so dates are going in as strings...</p>
  
  <p>Does anyone know how I would go about sorting on that string date?</p>
  
  <p>I have looked at _script</p>
  
  <pre><code>{
      "query" : {
          ....
      },
      "sort" : {
          "_script" : {
              "script" : "doc['field_name'].value",
              "type" : "string",
              "order" : "asc"
          }
      }
  }
  </code></pre>
  
  <p>But this fails because its an analysed field...</p>
  
  <p>Any suggestions would be great!</p>
  
  <p>Thanks</p>