Different document types with shared field names

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Different document types with shared field names

Christopher J. Bottaro
I'm trying to understand this correctly.  If I have two separate document types (my_type_1 and my_type_2), and they both have a field (my_field) which is defined different (string not analyzed and long), I can't do a search on my_type_1 sorting by my_field if there are any documents in the index of my_type_2 that have multiple values in my_field?

Because of this, I have to prefix all my fields with the document type... which seems wrong.  Am I missing something?

Thanks for the help.

References:

"Can't sort on string types with more than one value per doc, or more than one token per field"
http://elasticsearch-users.115913.n3.nabble.com/not-analyzed-attribute-gt-Can-t-sort-on-string-types-with-more-than-one-value-per-doc-or-more-than-od-td3848413.html

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Different document types with shared field names

Radu Gheorghe-2
Hello Christopher,

You might be able to reference the specific field you want with something like my_type_1.my_field, although it shouldn't work for faceting (source here).

The reason for it is that all your fields from all your types end up in the same Lucene indices (shards), so if you have the same field name in multiple types, it's best to have the same settings. Otherwise, you'll bump into the behavior you're reporting here.

Best regards,
Radu
-- 
http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

On Wed, May 8, 2013 at 1:01 AM, Christopher J. Bottaro <[hidden email]> wrote:
I'm trying to understand this correctly.  If I have two separate document types (my_type_1 and my_type_2), and they both have a field (my_field) which is defined different (string not analyzed and long), I can't do a search on my_type_1 sorting by my_field if there are any documents in the index of my_type_2 that have multiple values in my_field?

Because of this, I have to prefix all my fields with the document type... which seems wrong.  Am I missing something?

Thanks for the help.

References:

"Can't sort on string types with more than one value per doc, or more than one token per field"

--
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 [hidden email].
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.