Is it possible to query Elasticsearch giving it a range of strings?
Something that I'd imagine like:
Sample Mapping:
{
"resource" : {
"properties" : {
"Title" : {
"type" : "string"
},
"type_" : {
"index" : "not_analyzed",
"type" : "string"
},
"Summary" : {
"format" : "dateOptionalTime",
"type" : "date"
}
}
}
}
Sample Query:
{
"size" : 10,
"query" : {
"filtered" : {
"query" : {
"bool" : {
"should" : [ {
"text" : {
"Title" : {
"query" : "AAA",
"type" : "phrase_prefix"
}
}
}, {
"range" : {
"Title" : {
"from" : "BBB",
"to" : "CCC",
"include_lower" : true,
"include_upper" : true
}
}
} ],
"minimum_number_should_match" : 1
}
},
"filter" : {
"and" : {
"filters" : [{
"or" : {
"filters" : [ {
"term" : {
"type_" : "personType"
}
} ]
}
} ]
}
}
}
}
}
Data Indexed:
Resources with Titles 'AAA', 'BBB', 'CCC', 'DDD'
Result
Resource with Title 'AAA' (range didn't select 'BBB' and 'CCC')
Any help appreciated