mongoose-elasticsearch-xp
mongoose-elasticsearch-xp copied to clipboard
Unable to use field type "completion" from elasticsearch
trafficstars
The documentation is not so clear, so I had to ask this question,
Let's take for example I have this sample.js model
'use strict'
const Joi = require('joi')
const Mongoose = require('mongoose')
const Joigoose = require('joigoose')(Mongoose)
const MongoosasticXP = require('mongoose-elasticsearch-xp')
let SampleJoi = Joi.object().keys({
name: Joi.string().meta({es_indexed: true, /* es_type: 'completion' ? */})
// When I give es_type as completion, it still creates the type
// as keyword but not completion. I'm trying to implement auto
// complete using suggester in elasticsearch
//...
// Some schema
})
Here is the mapping generated from mongoose-elasticsearch-xp
{
"samples": {
"mappings": {
"Sample": {
"properties": {
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword", // I want this to be of type completion
"ignore_above": 256
}
}
}
}
}
}
}
}
I have the same problem, except for me the type is converted to object...
@jbdemonte Suggestions?
I had the similar problem. I think you need to call esCreateMapping to create the mapping manually.
@lhxatus could you please provide with some sample, using esCreateMapping for type completion as i am using suggest in my mapping