You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Yarden Bar <ay...@gmail.com> on 2017/05/25 07:49:09 UTC

Multiple mapping types sharing some field names with different datatypes

Hi all,
A question about collection (or mapping, I'm an ES user).

I have a use-case where I index AWS CloudTrail logs. currently, in ES, I
use the CT eventName as document type for dynamic mapping.
There are several event types which use the same field name but with
different datatype.
Example: eventName1, my_field_name, int
                eventName2, my_field_name, string

In ES, when a mapping has multiple types, fields with same name must have
the same type. is that also the case with Solr? is it related to Lucene?

Thank you in advance,
Jorden

Re: Multiple mapping types sharing some field names with different datatypes

Posted by Yarden Bar <ay...@gmail.com>.
Thank you Shawn for the detailed explanation.

I've posted this also in SO (with examples):
https://stackoverflow.com/questions/44181274/solr-mapping-types-sharing-field-name-but-different-datatype
this will shed some light on your mystery :)

On Thu, May 25, 2017 at 4:01 PM, Shawn Heisey <ap...@elyograg.org> wrote:

> On 5/25/2017 1:49 AM, Yarden Bar wrote:
> > A question about collection (or mapping, I'm an ES user).
> >
> > I have a use-case where I index AWS CloudTrail logs. currently, in ES, I
> > use the CT eventName as document type for dynamic mapping.
> > There are several event types which use the same field name but with
> > different datatype.
> > Example: eventName1, my_field_name, int
> >                 eventName2, my_field_name, string
> >
> > In ES, when a mapping has multiple types, fields with same name must
> have the same type. is that also the case with Solr? is it related to
> Lucene?
>
> In SolrCloud, a collection is an entire logical index, which can be
> comprised of multiple physical indexes (shard replicas), each of which
> can live on a different server.  Collections are comprised of shards.
> Shards are comprised of replicas.  Each replica is a core.  If you're
> not running in cloud mode, then there is technically no such thing as a
> collection, just cores.  Shards are possible when not in cloud mode, but
> there is no automatic management.
>
> If I have any kind of clue about what you're talking about, which I
> might not, I think that mappings in ES correspond to the schema in
> Solr.  The schema specifies field and fieldType definitions.
>
> Your last sentence is a mystery to me.  It doesn't make any sense to
> have multiple fields with the same name in one schema.  Solr would
> probably treat that as a configuration error.  Each field in a schema
> must reference a "type" which refers to a fieldType definition that is
> also in the same schema.
>
> Thanks,
> Shawn
>
>

Re: Multiple mapping types sharing some field names with different datatypes

Posted by Shawn Heisey <ap...@elyograg.org>.
On 5/25/2017 1:49 AM, Yarden Bar wrote:
> A question about collection (or mapping, I'm an ES user).
>
> I have a use-case where I index AWS CloudTrail logs. currently, in ES, I
> use the CT eventName as document type for dynamic mapping.
> There are several event types which use the same field name but with
> different datatype.
> Example: eventName1, my_field_name, int
>                 eventName2, my_field_name, string
>
> In ES, when a mapping has multiple types, fields with same name must have the same type. is that also the case with Solr? is it related to Lucene?

In SolrCloud, a collection is an entire logical index, which can be
comprised of multiple physical indexes (shard replicas), each of which
can live on a different server.  Collections are comprised of shards. 
Shards are comprised of replicas.  Each replica is a core.  If you're
not running in cloud mode, then there is technically no such thing as a
collection, just cores.  Shards are possible when not in cloud mode, but
there is no automatic management.

If I have any kind of clue about what you're talking about, which I
might not, I think that mappings in ES correspond to the schema in
Solr.  The schema specifies field and fieldType definitions.

Your last sentence is a mystery to me.  It doesn't make any sense to
have multiple fields with the same name in one schema.  Solr would
probably treat that as a configuration error.  Each field in a schema
must reference a "type" which refers to a fieldType definition that is
also in the same schema.

Thanks,
Shawn