Elasticsearch version ( bin/elasticsearch --version
): 6.8.5 - elastic cloud
Plugins installed : [mongoosastic]
Hello, I have a question regarding Mapping the Mixed type in ES where it doesn't support it, So we used the Multifield to solve the problem but the type boolean is not supported by ignore_malformed
where it works properly with number and date types only.
We create the mapping :
{
"mappings": {
"user": {
"properties": {
"attribute": {
"type": "nested",
"properties": {
"value": {
"type": "text",
"fields": {
"number": {
"type": "double",
"ignore_malformed": true
},
"date": {
"type": "date",
"ignore_malformed": true
},
"boolean": {
"type": "boolean"
}
}
}
}
}
}
}
}
}
Our schemas are :
User schema
var UserSchema = new Schema({
name: { type: String, es_indexed: true, required: true },
email: { type: String, es_indexed: true },
address: { type: [addressSchema], es_type: 'nested', es_indexed: true },
attribute: { type: [attribute], es_type: 'nested', es_indexed: true }
})
Attribute Schema
const attribute = new Schema({
inner_name: String,
value: {
type: Schema.Types.Mixed,
es_type: 'multi_field',
es_fields: {
string: { type: String, index: 'analyzed' },
date: { type: Date, index: 'analyzed' },
number: { type: Number, index: 'analyzed' },
boolean: { type: Boolean, index: 'analyzed' },
array: { type: Array, index: 'analyzed' },
object: { type: Object, index: 'analyzed' },
null: { type: null }
}
}
})
The Error was failed to parse the field of type [boolean]
Is there any parameter instead of ignore_malformed
that could support boolean type? or Is there any other solution for the mixed type?
Please response as soon as possible, this is crucial in our application.
Thanks in advance.