I'm migrating an application from Elasticsearch 1.7.5 to 2.4.4. One of the last issues I've encountered is flags are no longer supported. In the examples below, I'm trying to aggregate on a field to find tag values that start with "ja" (case insensitive). Is there an equivalent way to express this query from 1.7.5 in 2.4.4?
{
"size": 0,
"aggregations" : {
"tags" : {
"terms" : {
"field" : "tags.value_unanalyzed",
"size" : 25,
"order" : [ {
"_count" : "desc"
}, {
"_term" : "asc"
} ],
"include" : {
"pattern" : "^\\Qja\\E.*$",
"flags" : 2
}
}
}
}
}
The only thing I've come up with in 2.4.4 is this:
{
"size": 0,
"aggregations" : {
"tags" : {
"terms" : {
"field" : "tags.value_unanalyzed",
"size" : 25,
"order" : [ {
"_count" : "desc"
}, {
"_term" : "asc"
} ],
"include" : "(JA|ja|Ja|jA).*"
}
}
}
}
While this aggregation "does the job," it becomes expensive and slow very quickly. Is there another way I can express this query to get the equivalent case-insensitive starts-with behavior on a TERM aggregation from 1.7.5?