Thank you so much Rodu...solution worked for me... Regards, Paresh B.
On Thursday, 8 January 2015 21:11:47 UTC+5:30, Radu Gheorghe wrote: > > Thanks, David! I had no idea it works until... about one hour ago :) > > -- > Performance Monitoring * Log Analytics * Search Analytics > Solr & Elasticsearch Support * http://sematext.com/ > > On Thu, Jan 8, 2015 at 4:01 PM, David Pilato <[email protected] > <javascript:>> wrote: > >> Very nice Radu. I love this trick. :) >> >> -- >> *David Pilato* | *Technical Advocate* | *Elasticsearch.com >> <http://Elasticsearch.com>* >> @dadoonet <https://twitter.com/dadoonet> | @elasticsearchfr >> <https://twitter.com/elasticsearchfr> | @scrutmydocs >> <https://twitter.com/scrutmydocs> >> >> >> >> Le 8 janv. 2015 à 14:43, Radu Gheorghe <[email protected] >> <javascript:>> a écrit : >> >> Hi Paresh, >> >> If you want to sort on the field, I think it has to be the same type. So >> if you make everything a double, it should work for all numeric fields. To >> do that, you can use dynamic templates >> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/mapping-root-object-type.html#_dynamic_templates>. >> >> For example if you have this: >> >> "mappings" : { >> "_default_" : { >> "dynamic_templates" : [ { >> "long_to_float" : { >> "match" : "*", >> "match_mapping_type" : "long", >> "mapping" : { >> "type" : "float" >> } >> } >> } ] >> } >> } >> >> And add a new field with value=32, the field would be mapped as float >> instead of long. >> >> Best regards, >> Radu >> -- >> Performance Monitoring * Log Analytics * Search Analytics >> Solr & Elasticsearch Support * http://sematext.com/ >> >> On Thu, Jan 8, 2015 at 11:14 AM, Paresh Behede <[email protected] >> <javascript:>> wrote: >> >>> Hi, >>> >>> I have requirement of storing document in elastic search which will have >>> dynamic fields + those fields could have different data types values... >>> >>> For e.g., >>> Document 1 could have age field with value = 32, so when I would insert >>> 1st document in ES my index mapping will get created and age will be mapped >>> to Integer/Long >>> >>> Now if I get age = 32.5 in another document ES will throw me exception >>> of data type mismatch... >>> >>> Can you suggest what can I do to handle such scenario? >>> >>> As workaround we are creating different fields for different data types >>> like age.long / age.double but this also won't work if I have to do sorting >>> over age field... >>> >>> Kindly suggest... >>> >>> Thanks in advance, >>> Paresh Behede >>> >>> >>> >>> -- >>> 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/ec663bd5-cf3b-4a3f-8828-03c4c53d3837%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/elasticsearch/ec663bd5-cf3b-4a3f-8828-03c4c53d3837%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> -- >> 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/CAHXA0_09uEGnDtJegPyZ-FY%2BUeCzDs_N1_%2BPsCYxCHu7_ErZVw%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/elasticsearch/CAHXA0_09uEGnDtJegPyZ-FY%2BUeCzDs_N1_%2BPsCYxCHu7_ErZVw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> 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/E0768DFA-EF17-46F2-B488-5EC29A60E37D%40pilato.fr >> >> <https://groups.google.com/d/msgid/elasticsearch/E0768DFA-EF17-46F2-B488-5EC29A60E37D%40pilato.fr?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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/3f740c21-3a2f-4794-9ee1-fb0c4088b48e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
