Elasticsearch JSON mapping file curl throws 500
We switched to Elastisearch mappings as JSON files in https://gitlab.com/gl-infra/gitter-infrastructure/commit/11c3b49cfca3aa653d5bfe13c1a28188d577632a but they seem to be throwing a 500 now. I am guessing we need to actually send the data in the file vs the file name which the command seems to be doing.
These commands are normally run during the following (more docs about fixing rivers added here, https://gitlab.com/gitlab-org/gitter/webapp/merge_requests/1108),
$ ssh deployer@webapp-01
$ cd /opt/gitter-infrastructure/ansible/roles/elasticsearch/instances/prod/files/elastic-config/
# increment `INDEX_VERSION`, `sudo su` -> `vim vars-prod-preset`
$ source vars-prod-preset
$ ./01-create-index-with-mapping
✔ Inline payload
root@webapp-01:/opt/gitter-infrastructure/ansible/roles/elasticsearch/instances/prod/files/elastic-config# curl --fail -vi -XPUT 'http://es-alias-001.prod.gitter:9200/gitter18/_mapping/user?pretty=true' -d ' {
"user": { "dynamic" : "strict", "properties": { "displayName": { "type": "string", "norms": { "enabled": false } }, "username": { "type": "s tring", "norms": { "enabled": false } } } } }'
* Hostname was NOT found in DNS cache
* Trying 10.0.1.177...
* Connected to es-alias-001.prod.gitter (10.0.1.177) port 9200 (#0)
> PUT /gitter18/_mapping/user?pretty=true HTTP/1.1
> User-Agent: curl/7.35.0
> Host: es-alias-001.prod.gitter:9200
> Accept: */*
> Content-Length: 296
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 296 out of 296 bytes
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
Content-Type: application/json; charset=UTF-8
< Content-Length: 28
Content-Length: 28
<
{
"acknowledged" : true
}
* Connection #0 to host es-alias-001.prod.gitter left intact
❌ via JSON file
root@webapp-01:/opt/gitter-infrastructure/ansible/roles/elasticsearch/instances/prod/files/elastic-config# curl --fail -vi -XPUT 'http://es-alias-001.prod.gitter:9200/gitter18/_mapping/user?pretty=true' -d /opt/gitter-infrastructure/ansible/roles/elasticsearch/instances/prod/files/elastic-config/mappings/user-mapping.json
* Hostname was NOT found in DNS cache
* Trying 10.0.1.177...
* Connected to es-alias-001.prod.gitter (10.0.1.177) port 9200 (#0)
> PUT /gitter18/_mapping/user?pretty=true HTTP/1.1
> User-Agent: curl/7.35.0
> Host: es-alias-001.prod.gitter:9200
> Accept: */*
> Content-Length: 117
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 117 out of 117 bytes
* The requested URL returned error: 500 Internal Server Error
* Closing connection 0
curl: (22) The requested URL returned error: 500 Internal Server Error