I'm using elasticsearch cluster version 1.7.2, and trying to change the mapping (I think) of one of the fields to ignore this character: '-'
the field is 'Request.Headers.Host', and the value can include '-' like: "app-cdn.cap.com"
#curl -X GET http://10.2.5.181:9200?pretty
{
"status" : 200,
"name" : "log-zone-a",
"cluster_name" : "cap-logs",
"version" : {
"number" : "1.7.2",
"build_hash" : "e43676b1385b7f593f7202acbd816e8ec",
"build_timestamp" : "2015-09-14T09:49:53Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}
I saw it's related to the parameter not_analyzed, and from what I've found in the web, I tried this:
#curl -X PUT '{"mappings":{"logs":{"properties":{"Request.Headers.Host":{"type":"string","index":"not_analyzed"}}}}}' http://10.2.5.181:9200/logstash-2016.12.27/logs/_mapping?pretty
curl: (3) [globbing] nested braces not supported at pos 13
{
"error" : "ActionRequestValidationException[Validation Failed: 1: mapping source is empty;]",
"status" : 400
}
#curl -H 'Accept: application/json' -X PUT http://10.2.5.181:9200/logstash-2016.12.27?pretty -d @/home/moses/mapping.json
{
"error" : "RemoteTransportException[[log-zone-b][inet[/10.2.105.181:9300]][indices:admin/create]]; nested: IndexAlreadyExistsException[[logstash-2016.12.27] already exists]; ",
"status" : 400
}
#cat /home/moses/mapping.json | jq .
{
"logstash-2016.12.27": {
"mappings": {
"logs": {
"properties": {
"Request.Headers.Host": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
When I'm changing the mapping and doing the same for non existing index it's success but the index seems wrong, separate the 'Request.Headers.Host' with the dots :(
#cat /home/moses/mapping.json
{"Request.Headers.Host":{"type":"string","index":"not_analyzed"}}
#curl -H 'Accept: application/json' -X PUT http://10.2.5.181:9200/logstash-2016.12.30?pretty -d @/home/moses/mapping.json
{
"acknowledged" : true
}
#curl -H 'Accept: application/json' -X GET http://10.2.5.181:9200/logstash-2016.12.30?pretty
{
"logstash-2016.12.30" : {
"aliases" : { },
"mappings" : { },
"settings" : {
"index" : {
"creation_date" : "1483011476137",
"Request" : {
"Headers" : {
"Host" : {
"type" : "string",
"index" : "not_analyzed"
}
}
},
"uuid" : "M6Ly0wvwTGu1aulSViYcPg",
"number_of_replicas" : "1",
"number_of_shards" : "5",
"version" : {
"created" : "1070299"
}
}
},
"warmers" : { }
}
}
How do I set this kind of mapping configuration to the current indexes and future indexes?
Thanks, Moshe