I am going through the documentation and understood that multi_field is used to apply different analyzers on one field.
{
"tweet" : {
"properties" : {
"name" : {
"type" : "multi_field",
"fields" : {
"name" : {"type" : "string", "index" : "analyzed"},
"untouched" : {"type" : "string", "index" : "not_analyzed"}
}
}
}
}
}
I have indexed the data as follows
/tweet/1 {
"name" : "anil"
}
And I am searching for the same as follows.
/<indexname>/_search
I am getting the data as follows.
hits : [
{
"_index" : ...
....
"_source" : {
"name" : "anil"
}
}
]
So far this is good.
Now I am looking for match.
GET <indexname>/_search
{
"query": {
"match": {
"name": "anil"
}
}
}
The above one works fine since I have the analyzer applied on it.
My question is, If I want to apply filter with exact string, I am getting 0 hits.
GET <indexname>/_search
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"term": {
"name" : "anil"
}
}
}
}
}
Please suggest what to do.