Hi,
I need to do exact string search on one of field in my documents
(preface you can see in my SO question [1]). So I probably need to
change index mapping for this field from the default to something what
doesn't try to process input string. But here I stuck.
I probably need to change analyzer type, used for particular field
with Put Mapping API [2], but I just can't find the right way to do
that. I fount an example, where the "not_analyzed" index was used for
a field ([3], the second snippet), but it's unclear was it created or
it is a default option?
Furthermore, Get Settings method [4] just fails for my index with the
message: "No handler found for uri [/records/_settings/] and method
[GET]". So I can't inspect current configuration state.
I'll appreciate any tips about how I can solve this issues.
[1] http://stackoverflow.com/questions/6465852/how-to-search-by-array-elements-in-elasticsearch
[2] http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html
[3] http://www.elasticsearch.org/guide/reference/mapping/core-types.html
[4] http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html
Hi Alexey
I need to do exact string search on one of field in my documents
(preface you can see in my SO question [1]). So I probably need to
change index mapping for this field from the default to something what
doesn't try to process input string. But here I stuck.
I probably need to change analyzer type, used for particular field
with Put Mapping API [2], but I just can't find the right way to do
that. I fount an example, where the "not_analyzed" index was used for
a field ([3], the second snippet), but it's unclear was it created or
it is a default option?
If you want a string field to not be analyzed, then you need to specify
it manually. You can do this when you create the index, or you can put
the mapping later, but you can't change the mapping for a field once it
already exists (eg after you have indexed data that includes that
field).
Here is an example of how to do it when creating an index:
curl -XPUT 'http://127.0.0.1:9200/foo/?pretty=1' -d '
{
"mappings" : {
"my_type" : {
"properties" : {
"myfield" : {
"index" : "not_analyzed",
"type" : "string"
}
}
}
}
}
'
Furthermore, Get Settings method [4] just fails for my index with the
message: "No handler found for uri [/records/_settings/] and method
[GET]". So I can't inspect current configuration state.
What version of ES are you using?
The call should look like this:
curl -XGET 'http://127.0.0.1:9200/records/_settings?pretty=1'
clint
Thank you, this mapping works exactly as expected!
My ES version is 0.15.2. The call "curl -XGET
'http://127.0.0.1:9200/records/_settings?pretty=1'" returns this
response:
"No handler found for uri [/records/_settings?pretty=1] and method [GET]"
On Mon, Jun 27, 2011 at 10:18 PM, Clinton Gormley
clinton@iannounce.co.uk wrote:
Hi Alexey
I need to do exact string search on one of field in my documents
(preface you can see in my SO question [1]). So I probably need to
change index mapping for this field from the default to something what
doesn't try to process input string. But here I stuck.
I probably need to change analyzer type, used for particular field
with Put Mapping API [2], but I just can't find the right way to do
that. I fount an example, where the "not_analyzed" index was used for
a field ([3], the second snippet), but it's unclear was it created or
it is a default option?
If you want a string field to not be analyzed, then you need to specify
it manually. You can do this when you create the index, or you can put
the mapping later, but you can't change the mapping for a field once it
already exists (eg after you have indexed data that includes that
field).
Here is an example of how to do it when creating an index:
curl -XPUT 'http://127.0.0.1:9200/foo/?pretty=1' -d '
{
"mappings" : {
"my_type" : {
"properties" : {
"myfield" : {
"index" : "not_analyzed",
"type" : "string"
}
}
}
}
}
'
Furthermore, Get Settings method [4] just fails for my index with the
message: "No handler found for uri [/records/_settings/] and method
[GET]". So I can't inspect current configuration state.
What version of ES are you using?
The call should look like this:
curl -XGET 'http://127.0.0.1:9200/records/_settings?pretty=1'
clint
--
Best regards,
Alexey Zlobin.
On Tue, 2011-06-28 at 11:32 +0400, Alexey Zlobin wrote:
Thank you, this mapping works exactly as expected!
My ES version is 0.15.2. The call "curl -XGET
'http://127.0.0.1:9200/records/_settings?pretty=1'" returns this
response:
"No handler found for uri [/records/_settings?pretty=1] and method [GET]"
This was only added in version 0.16
clint