I am newbie in elastic search and I have been experimenting with it from the past few days. I am not able to do proper mapping as all the data types, I mentioned in the mapping are being mapped to the type "word" instead of the respective types. Here is the mapping I have done
POST my_index
{
"settings" : {
"analysis" : {
"analyzer" : {
"lowercase_analyzer" : {
"type" : "custom",
"tokenizer" : "keyword",
"filter" : ["lowercase"]
}
}
}
},
"mappings" : {
"my_type" : {
"properties" : {
"name" : {"type" : "string" ,"index" : "not_analyzed" },
"field0" : {
"properties" : {
"field1" : {"type" : "boolean" },
"field2" : {"type" : "string" },
"field3" : {"type" : "date", "format" : "yyyy-MM-dd HH:mm:ss SSSSSS" }
}
}
}
}
}
}
To test the mapping, I am using "_analyze" api as follows
GET my_index/_analyze
{
"field" : "name",
"text" : "10.90.99.6"
}
which gives me the following result
{
"tokens": [
{
"token": "10.90.99.6",
"start_offset": 0,
"end_offset": 10,
"type": "word",
"position": 0
}
]
}
I am expecting the "type" in the result to be "string". However I could not understand why it is returning of type "word". Also the same is happening with other fields as well when I post the data of type boolean or time stamp in the nested fields using _analyze api.
GET my_index/_analyze
{
"field" : "field0.field1",
"text" : "true"
}
Result
{
"tokens": [
{
"token": "true",
"start_offset": 0,
"end_offset": 4,
"type": "word",
"position": 0
}
]
}
Where am I doing wrong in my mapping.
Also, there is no such "word" data type in elastic search reference api.