You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, I have a schema, and it has user property, like:
user: {
type: Schema.Types.ObjectId,
ref: 'User',
es_indexed: true,
es_type: 'string',
es_index_analyzer: 'keyword',
es_cast: function(value){
if (value._id) {
return value.id;
} else {
return value.toString();
}
}
}
Because I don't want to analyze the user property, and add es_index_analyzer: 'keyword', but I found out that when mongoosastic meet ObjectId type, it will neglect other es_ setting, and that may not meet my need.
The text was updated successfully, but these errors were encountered:
for line 55 -> 73, there shouldn't has continue in if
// If it is a objectid make it a string.
if(value.type === 'objectid'){
mapping[field].type = 'string';
continue;
}
//If indexing a number, and no es_type specified, default to double
if (value.type === 'number' && value['es_type'] === undefined) {
mapping[field].type = 'double';
continue;
}
// Else, it has a type and we want to map that!
for (var prop in value) {
// Map to field if it's an Elasticsearch option
if (prop.indexOf('es_') === 0 && prop !== 'es_indexed') {
mapping[field][prop.replace(/^es_/, '')] = value[prop];
}
}
For example, I have a schema, and it has user property, like:
user: {
type: Schema.Types.ObjectId,
ref: 'User',
es_indexed: true,
es_type: 'string',
es_index_analyzer: 'keyword',
es_cast: function(value){
if (value._id) {
return value.id;
} else {
return value.toString();
}
}
}
Because I don't want to analyze the user property, and add es_index_analyzer: 'keyword', but I found out that when mongoosastic meet ObjectId type, it will neglect other es_ setting, and that may not meet my need.
The text was updated successfully, but these errors were encountered: