Elasticsearch: Custom index-level metadata

Created on 29 Jan 2012  ·  12Comments  ·  Source: elastic/elasticsearch

Provide a way to attach metadata to an index, similar to what can be
done with type mappings.

discuss

Most helpful comment

@clintongormley i would like to put my vote on implementing index-level meta. I guess a lot of ES users would love to attach some data about index to index itself (mapping version so ingesters would know which encoder they should use; creation time; node that created index; list of forced refreshes/merges; list of manual interventions; etc, etc), i think it would be as useful as per-document _meta field.

All 12 comments

No, that's the type-mapping-level meta data I referred to.

create index with custom meta

{
"settings" : {
"number_of_shards" : 3,
"number_of_replicas" : 2
},
"custom_meta" : {
"name1" : "value1",
"name2" : { "attr1": "value1", "attr2":"value2"},
"name3" : number
}
}

delete
/{index}/_custom_meta
/{index}/_custom_meta/{name}

put
/{index}/_custom_meta/{name}

get
/{index}/_custom_meta
/{index}/_custom_meta/{name}

Perhaps something that could be supported via index settings?

After discussion, this could simply be implemented by using a type meta and storing one document in it. Closing

@clintongormley Elasticsearch removed the support for having multible types in an index starting in version 6.0.
Do you have any updated advise for storing per-index metadata?

@brusic is it a cheap operation? At the moment I update a meta document inside a bulk request to make sure the meta data is en par with my indexed data. So I would make an index update for every indexed document..

First of all, I was slightly mistaken in my previous statement. Clinton referred to a meta type, not the now official meta field (which did not exist at the time).

I have never used the meta field since they were introduced years after this issue was open and I found other alternatives. I would assume that the meta field is added to the cluster state, which could make this an expensive operation. The cluster state needs to propagate new differences to other nodes in the cluster, which I think would make it slower than simply indexing a document (since there is no buffering and whatnot).

Thanks for the precise answer!

I'll use a seperate index for the index metadata as it's possible to index/update documents in different indices at the same time with a bulk request.

@clintongormley i would like to put my vote on implementing index-level meta. I guess a lot of ES users would love to attach some data about index to index itself (mapping version so ingesters would know which encoder they should use; creation time; node that created index; list of forced refreshes/merges; list of manual interventions; etc, etc), i think it would be as useful as per-document _meta field.

Was this page helpful?
0 / 5 - 0 ratings