Hyphenated aliases do not work


(makovskij) #1

I have an setup with aliases like that:

Index: 2009_12
aliases:
2009
test-index_de_2009 (filter)
test_de_2009 (filter)

If I use 2009/_search or 2009_12/_search i get all documents.
if I use test_de_2009/_search i get only the documents on a filtered field "name". I have the same filtered function with test-index_de_2009 and the "name" field, but i get no results when i search with test-index_de_2009/_search.

Whats the reason? I think its the hyphen, but i dont know why this happen and how to fix it.

regards
andi


(Mark Walkom) #2

Can you share the alias creation commands you used?


(makovskij) #3

String year = yearMonth.split("")[0];
if (!checkIndexExist(yearMonth))
{
try{
CreateIndexResponse indexResp;
indexResp = client.admin().indices().prepareCreate(yearMonth)
// .setSettings(ImmutableSettings.settingsBuilder().put("number_of_shards",shardNumber).put("number_of_replicas", replicaNumber))
.setSource(DEFAULT_MAPPING.toJSONString())
.execute().actionGet();
client.admin().indices().prepareAliases().
addAlias(yearMonth, year).execute().actionGet();
}catch(IndexAlreadyExistsException e)
{
// just ignore
}
}
//make filtered alias
try{
FilterBuilder filter = FilterBuilders.termFilter("db",index);
client.admin().indices().prepareAliases().addAlias(yearMonth,index+"
"+year,filter).execute().actionGet();

"db" is the filtered alias field and has default mapping (string, standard analyzer).


(system) #4