Thanks Matt
I am treating "Ford in Detroit" as a phrase and it is working fine for me
and I am getting correct results
But when I search Ford in Detroit I am doing a multi single word search
i.e. I am searching for Ford AND Detroit after removing the stop words .
Ford and Detroit can be in any place in text
But ES does not convert (Ford AND in AND Detroit) to (Ford AND Detroit)
after applying stop words
So I need when ES see Ford in Detroit it should treat it as Ford Detroit
Here is the json when I send "Ford in Detroit" , (Ford Detroit) or (Ford in
Detroit)
When "Ford in Detroit"
{
"filtered": {
"query": {
"constant_score": {
"query": {
"multi_match": {
"query": "Ford in Detroit",
"fields": [
"authorName",
"authorTags",
"cnt_en",
"permalink",
"t_en"
],
"type": "phrase",
"operator": "AND",
"use_dis_max": false
}
},
"boost": 1
}
},
"filter": {
"and": {
"filters": [
{
"or": {
"filters": [
{
"term": {
"authorCountry": "United States",
"_cache": false
}
}
]
}
},
{
"or": {
"filters": [
{
"term": {
"authorLanguage": 12,
"_cache": false
}
}
]
}
},
{
"numeric_range": {
"publishedDate": {
"from": 1356220800000,
"to": 1358985600000,
"include_lower": true,
"include_upper": true
}
}
}
]
}
}
}
}
When Ford Detroit
{
"filtered": {
"query": {
"constant_score": {
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "Detroit",
"fields": [
"authorName",
"authorTags",
"cnt_en",
"permalink",
"t_en"
],
"type": "boolean",
"operator": "AND",
"use_dis_max": false
}
},
{
"multi_match": {
"query": "Ford",
"fields": [
"authorName",
"authorTags",
"cnt_en",
"permalink",
"t_en"
],
"type": "boolean",
"operator": "AND",
"use_dis_max": false
}
}
]
}
},
"boost": 1
}
},
"filter": {
"and": {
"filters": [
{
"or": {
"filters": [
{
"term": {
"authorCountry": "United States",
"_cache": false
}
}
]
}
},
{
"or": {
"filters": [
{
"term": {
"authorLanguage": 12,
"_cache": false
}
}
]
}
},
{
"numeric_range": {
"publishedDate": {
"from": 1356220800000,
"to": 1358985600000,
"include_lower": true,
"include_upper": true
}
}
}
]
}
}
}
}
When Ford in Detroit
{
"filtered": {
"query": {
"constant_score": {
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "in",
"fields": [
"authorName",
"authorTags",
"cnt_en",
"permalink",
"t_en"
],
"type": "boolean",
"operator": "AND",
"use_dis_max": false
}
},
{
"multi_match": {
"query": "Detroit",
"fields": [
"authorName",
"authorTags",
"cnt_en",
"permalink",
"t_en"
],
"type": "boolean",
"operator": "AND",
"use_dis_max": false
}
},
{
"multi_match": {
"query": "Ford",
"fields": [
"authorName",
"authorTags",
"cnt_en",
"permalink",
"t_en"
],
"type": "boolean",
"operator": "AND",
"use_dis_max": false
}
}
]
}
},
"boost": 1
}
},
"filter": {
"and": {
"filters": [
{
"or": {
"filters": [
{
"term": {
"authorCountry": "United States",
"_cache": false
}
}
]
}
},
{
"or": {
"filters": [
{
"term": {
"authorLanguage": 12,
"_cache": false
}
}
]
}
},
{
"numeric_range": {
"publishedDate": {
"from": 1356220800000,
"to": 1358985600000,
"include_lower": true,
"include_upper": true
}
}
}
]
}
}
}
}
On Monday, January 21, 2013 3:32:16 PM UTC-8, suleman mubarik wrote:
Hi I have this search query (Ford in Detroit)
It is evaluating as (Ford AND in AND Detroit)
When I apply the stop word filter (analyzer) it become (Ford AND AND
Detroit)
When I run this
Here is the JSON which ES is evaluating
{ "filtered" : { "query" : { "constant_score" : { "query" : { "bool" : {
"must" : [ { "multi_match" : { "query" : "in", "fields" : [ "authorName",
"authorTags", "cnt_en", "permalink", "t_en" ], "type" : "boolean",
"operator" : "AND", "use_dis_max" : false } }, { "multi_match" : {
"query" : "Detroit", "fields" : [ "authorName", "authorTags", "cnt_en",
"permalink", "t_en" ], "type" : "boolean", "operator" : "AND",
"use_dis_max" : false } }, { "multi_match" : { "query" : "Ford", "fields" :
[ "authorName", "authorTags", "cnt_en", "permalink", "t_en" ], "type" :
"boolean", "operator" : "AND", "use_dis_max" : false } } ] } }, "boost" :
1.0 } }, "filter" : { "and" : { "filters" : [ { "or" : { "filters" : [ {
"term" : { "authorCountry" : "United States", "_cache" : false } } ] } }, {
"or" : { "filters" : [ { "term" : { "authorLanguage" : 12, "_cache" : false
} } ] } }, { "numeric_range" : { "publishedDate" : { "from" :
1355616000000, "to" : 1358467199999, "include_lower" : true,
"include_upper" : true } } } ] } } } }
Is there a way so the ES analyzer remove the multi_match when it find the
stop word and in that case my search term will become (Ford AND Detroit)
or any idea how can i remove this
Thanks
--