Ben_M
(Ben)
October 5, 2015, 4:13pm
1
I don't appear to have the ability to add analyzers. I'm attempting the Spanish analyzer example from the ES website. My settings are as follows:
"settings" : {
"index" : {
"creation_date" : "1444061187427",
"analysis" : {
"analyzer" : {
"es_std" : {
"type" : "standard",
"stopwords" : "_spanish_"
},
"content" : {
"type" : "custom",
"tokenizer" : "whitespace"
}
}
},
"number_of_shards" : "5",
"number_of_replicas" : "2",
"version" : {
"created" : "1050299"
},
"uuid" : "lAUSIkAbKP2Jk-v3uXDFaB"
}
}
I then get the following response for this call:
curl -XGET -u dev-user:foobar 'https://foo.bar:1234/_analyze?analyzer=es_std' -d 'El veloz zorro marrón'
{"error":"ElasticsearchIllegalArgumentException[failed to find analyzer [es_std]]","status":400}
What am I doing wrong?
Thanks,
Ben
Ben_M
(Ben)
October 6, 2015, 12:09am
2
I've simplified my structure. Here's some updated JSON with more detail. I've tried a number of analyzers but still get the same error. I've trawled through the docs and have stripped the model right back to test but still can't figure this out.
{
"myIndex" : {
"aliases" : { },
"mappings" : {
"story" : {
"properties" : {
"clips" : {
"properties" : {
"description" : {
"type" : "string"
},
"title" : {
"type" : "string",
"analyzer" : "es_std"
}
}
},
"title" : {
"type" : "string"
}
}
}
},
"settings" : {
"index" : {
"creation_date" : "1444089042546",
"number_of_shards" : "5",
"analysis" : {
"analyzer" : {
"es_std" : {
"type" : "standard",
"stopwords" : "_spanish_"
}
}
},
"number_of_replicas" : "1",
"version" : {
"created" : "1050299"
},
"uuid" : "wzmcLKSJDLGyX43yNBDzDQ"
}
},
"warmers" : { }
}
}
/_analyze?analyzer=es_std' -d 'El veloz zorro marrón'
{"error":"ElasticsearchIllegalArgumentException[failed to find analyzer [es_std]]","status":400}
The "analysis" object goes straight under "settings". It's not nested under "index".
"settings" : {
"analysis" : {
"analyzer" : {
...
}
},
...
}
Ben_M
(Ben)
October 6, 2015, 8:20am
4
I've tried what you said but no luck - it places the analyzer below my index. Here are my exact steps. No other indexes exist.
curl -u dev-user:password -XPUT 'https://foo.com:10724/myindex?pretty'
{
"acknowledged" : true
}
curl -u dev-user:password -XPOST 'https://foo.com:10724/myindex/_close?pretty'
{
"acknowledged" : true
}
curl -u dev-user:password -XPUT 'https://foo.com:10724/_settings?pretty' -d '{"settings":{"analysis":{"analyzer":{"es_std":{ "type":"standard","stopwords":"_spanish_"}}}}}'
{
"acknowledged" : true
}
curl -u dev-user:password -XPOST 'https://foo.com:10724/myindex/_open?pretty'
{
"acknowledged" : true
}
curl -XGET -u dev-user:password 'https://foo.com:10724/myindex/?pretty&_mapping'
{
"myindex" : {
"aliases" : { },
"mappings" : { },
"settings" : {
"index" : {
"creation_date" : "1444119219943",
"number_of_shards" : "5",
"analysis" : {
"analyzer" : {
"es_std" : {
"type" : "standard",
"stopwords" : "_spanish_"
}
}
},
"number_of_replicas" : "2",
"version" : {
"created" : "1050299"
},
"uuid" : "iFm3U1RER2CopMwFSWAI3w"
}
},
"warmers" : { }
}
}
curl -XGET -u dev-user:password 'https://foo.com:10724/_analyze?analyzer=es_std&pretty' -d 'El veloz zorro marrón'
{
"error" : "ElasticsearchIllegalArgumentException[failed to find analyzer [es_std]]",
"status" : 400
}
dadoonet
(David Pilato)
October 6, 2015, 8:32am
5
Try this:
curl -XGET -u dev-user:password 'https://foo.com:10724/myindex/_analyze?analyzer=es_std&pretty' -d 'El veloz zorro marrón'
Ben_M
(Ben)
October 6, 2015, 8:37am
6
That's it! Many thanks everyone.