jbdemonte / mongoose-elasticsearch-xp

A mongoose plugin that indexes models into Elasticsearch 2 / 5 / 6 and 7
92 stars 33 forks source link

Multi fields #27

Open michelem09 opened 7 years ago

michelem09 commented 7 years ago

Is there a way to use multi fields? In moongoosastic I was able to do something like this:

name: {
    type: String,
    es_indexed: true,
    es_type: 'multi_field',
    es_fields: {
        analyzed: { type: 'string', index: 'analyzed' },
        raw: { type: 'string', index: 'not_analyzed' }
    }
}
jbdemonte commented 7 years ago

Maybe https://github.com/jbdemonte/mongoose-elasticsearch-xp#adding-fields or https://github.com/jbdemonte/mongoose-elasticsearch-xp#change-fields-value ?

michelem09 commented 7 years ago

Hard to find the correct way to replicate that. By now I just PUT the same mapping in the new index but of course I lose the ability to auto create the mapping from the schema. I will continue to try something. Thanks

mikevercoelen commented 6 years ago

@michelem09 Is there a way to have multi-field support?

jbdemonte commented 6 years ago

all you want to send to ES has only to be prefixed with es_, so, you should be able to do everythink