What does a 406 (Not Acceptable) error code from elasticsearch mean?
The incident
object is not a properly serialized JSON string. You need to call JSON.stringify(this.incident)
in order to get the equivalent JSON string, and specify the application/json
HTTP header.
$.ajax({ url: 'http://example.com:9200/incidents/incidents', type: 'POST', data: JSON.stringify(this.incident), dataType: 'json' })