On 5/17/2016 9:05 AM, Horváth Péter Gergely wrote: > By default Solr allows you to define the type of a dynamic field by > appending a post-fix to the name itself. E.g. creating a color_s field > instructs Solr to create a string field. My understanding is that if we do > this, all queries must refer the post-fixed field name as well. So > instead of a query like color:"red", we will have to write something like > color_s:"red" -- and so on for other field types as well. > > I am wondering if it is possible to specify the data type used for a field > in Solr 6.0.0, without having to modify the field name. (Or at least in a > way that would allow us to use the original field name) Do you have any > idea, how to achieve this? I am fine, if we have to specify the field type > during the insertion of a document, however, I do not want to keep using > post-fixes while running queries...
Dynamic fields are just a different way to specify field names. Instead of explictly naming the field, you can put a * at the beginning or end of the name and define an entire series of potential field names with one declaration, and tie those names to a specific type. You can't specify a field type when doing a query, only the field name. Solr looks up the field name in the schema to determine the type. If you want to change the type of a given field name, you need to change your schema, restart Solr or reload the core, and quite possibly also reindex. Thanks, Shawn