Hi Alex, thanks for your reply first of all. The problem is that I will have millions of keys, and that ES creates a mapping for each. That will bloat the mappings data structure and probably lead to some memory and/or performance issues somewhere (I don't know enough about ES internals, to know precisely where, but it cannot be good to have a few million entries in the mapping where one would do.)
Hope that helps! Peter Am Dienstag, 14. Januar 2014 13:01:22 UTC+1 schrieb Alexander Reelsen: > > Hey Peter, > > can you tell me, where your problem with the above approach actually is? > You feed a number of key/value pairs into elasticsearch, each key and each > value is evaluated by its type and then put into the mapping, as each key > becomes an own field in elasticsearch, which can be searched for. Wondering > why this is a problem for you? Or why do you want to avoid that? > > Also, where and how do you want to change the mapping to? > > I am a bit confused what and why you are expecting to be different than it > actually is. Maybe you should not think in java data structures but rather > in JSON, which is being indexed and needs to create a mapping in order to > be able to search for it. Happy to help, if I understand what you are > trying to do. Please elaborate. > > > --Alex > > > On Mon, Jan 13, 2014 at 11:15 AM, Oliver B. Fischer > <[email protected]<javascript:> > > wrote: > >> Hi Peter, >> >> ES allows you to defined dynamic mappings there you can determine the >> mapping of a property based on the evaluation of some conditions. >> >> http://www.elasticsearch.org/guide/en/elasticsearch/ >> reference/current/mapping-dynamic-mapping.html >> >> Oliver >> >> Am 12.01.14 17:16, schrieb Peter Webber: >> >> >>> I had a look at the mapping ES created automatically for one of my >>> indices, and found something that's not quite right: >>> >>> .... >>> ||| "annotations"| |: { | >>> |||"properties"| |: { | >>> |||"ids"| |: { | >>> |||"properties"| |: { | >>> |||"hashMap"| |: { | >>> |||"properties"| |: { | >>> |||"N_10290607"| |: { | >>> |||"type"| |: ||"double"| >>> |||}, | >>> |||"A_1038408"| |: { | >>> |||"type"| |: ||"double"| >>> |||}, | >>> |||"A_11585994"| |: { | >>> |||"type"| |: ||"double"| >>> |||}, | >>> |||"B_1245677"| |: { | >>> |||"type"| |: ||"double"| >>> |||}, | >>> |||"B_1269810"| |: { | >>> |||"type"| |: ||"double"| >>> |||}, | >>> |||"C_15680034"| |: { | >>> |||"type"| |: ||"double"| >>> |||}, | >>> |||"N_1654171"| |: { | >>> |||"type"| |: ||"double"| >>> |||}, >>> ... >>> >>> I use Gson to convert Java classes to Json and then directly put them >>> into ES. One of the classes I use has a HashMap<String, Double> as a >>> central piece, where it stores its key-value pairs. It's really just >>> that: the keys are stings, the values doubles. ES however creates a >>> mapping for every key of the hashmap as you can see above. >>> >>> Does someone here know what mapping I need to define to avoid that? >>> >>> Also: Can I change this mapping on the already existing index, or do I >>> have to create a new index, then create a mapping, then copy over the >>> data from the old index? >>> >>> Many Thanks! >>> | >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elasticsearch" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected] <javascript:>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elasticsearch/4cfa6af7- >>> 4329-4edc-b4dc-385a4a38714d%40googlegroups.com. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elasticsearch" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit https://groups.google.com/d/ >> msgid/elasticsearch/52D3BCAD.5060208%40swe-blog.net. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d31222dc-8263-4d8f-adac-01ec9ea787cd%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
