Filter query always returns empty


(Harish Ramanathan) #1

I am running the query as below in Elasticsearch. Even though there are multiple documents with the filter criteria matching available, I get an empty response. Any help is appreciated

{
"bool" : {
"filter" : [ {
"range" : {
"CREATE_TIME" : {
"from" : "2013-01-01T00:00:00.000Z",
"to" : "2015-12-31T00:00:00.000Z",
"include_lower" : true,
"include_upper" : true
}
}
}, {
"range" : {
"MODIFY_TIME" : {
"from" : "2013-01-01T00:00:00.000Z",
"to" : "2015-12-31T00:00:00.000Z",
"include_lower" : true,
"include_upper" : true
}
}
} ],
"should" : [ {
"match" : {
"NAME" : {
"query" : "Cat",
"type" : "phrase",
"boost" : 6.0
}
}
}, {
"match" : {
"COL_NAME" : {
"query" : "Cat",
"type" : "phrase",
"boost" : 5.0
}
}
}, {
"match" : {
"SAMPLE_NAME" : {
"query" : "Cat",
"type" : "phrase",
"boost" : 3.0
}
}
}, {
"match" : {
"DESCRIPTION" : {
"query" : "Cat",
"type" : "phrase",
"boost" : 2.0
}
}
}, {
"match" : {
"SAMPLE_DESCRIPTION" : {
"query" : "Cat",
"type" : "phrase",
"boost" : 1.0
}
}
}, {
"match" : {
"EXAMPLE" : {
"query" : "Cat",
"type" : "phrase",
"boost" : 6.0
}
}
} ],
"minimum_should_match" : "1"
}
}

The Format of Timestamp is same in the index.


(Geunmoon Oh) #2

how about using keyword 'cat' instead of 'Cat'?
Analyzed keyword is commonly lower character.


(David Pilato) #3

Might depends on your mapping.
Can you provide it and a matching document?

Within a script would be even better.


(system) #4