Reputation: 3096
I'm playing with ES 2.1 analyzers on the following index (aptly named my_index) :
$ curl -XPUT 'localhost:9200/my_index/' -d '
{
"settings" : {
"analysis" : {
"analyzer" : {
"my_synonym_analyzer" : {
"tokenizer" : "standard",
"filter" : [ "my_synonym_filter" ]
}
},
"filter" : {
"my_synonym_filter" : {
"type" : "synonym",
"synonyms" : [ "foo, bar" ]
}
}
}
},
"mappings" : {
"my_type" : {
"properties" : {
"my_field" : {
"type" : "string",
"analyzer" : "my_synonym_analyzer"
}
}
}
}
}'
The following analyses work as expected:
$ curl -XGET 'localhost:9200/my_index/_analyze?analyzer=my_synonym_analyzer&text=foo'
$ curl -XGET 'localhost:9200/my_index/_analyze?field=my_field&text=foo'
{
"tokens" : [ {
"token" : "foo",
"start_offset" : 0,
"end_offset" : 3,
"type" : "<ALPHANUM>",
"position" : 0
}, {
"token" : "bar",
"start_offset" : 0,
"end_offset" : 3,
"type" : "SYNONYM",
"position" : 0
} ]
}
However this one is not. I expect the same output as above, as stated in the reference.
$ curl -XGET 'localhost:9200/my_index/_analyze?field=my_type.my_field&text=foo'
{
"tokens" : [ {
"token" : "foo",
"start_offset" : 0,
"end_offset" : 3,
"type" : "<ALPHANUM>",
"position" : 0
} ]
}
Am I missing something ?
Upvotes: 0
Views: 65
Reputation: 217564
Starting in ES 2.0, field names may not be prefixed with the type name anymore, even though it used to work with pre-2.x releases of Elasticsearch.
So if you're using Elasticsearch 2.x, what you're observing is what you're supposed to get, i.e.
field=my_field
worksfield=my_type.my_field
does not anymore.Upvotes: 1