#node.js #elasticsearch
Вопрос:
Вот в чем проблема, я создал новое свойство, подобное этому
ПОМЕСТИТЕ /мой индекс-000001 // просто пример формы url
{// actual property
"abonents-physical": {
"properties": {
"plumbsList": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
Хорошо, он был добавлен в новые свойства.
Но когда я выполняю этот запрос- > …/абоненты-физические/абоненты-физические/_search, он не ищет его.
И если запрос /абоненты-физические/абоненты-физические/_search в браузере, такого свойства нет
Code
if(searchValue === 'plumbNumber'){
console.log('plumbNumber',value);
body.query.bool.should.push(
{
"match_phrase_prefix":{
"plumbsList": {
"query": value,
"slop": 10
}
}
},
);
}
There is already written code for searching counters and it works:
if(searchValue === 'counterName'){
console.log('counterName',value);
body.query.bool.should.push(
{
"match_phrase_prefix":{
"countersList": {
"query": value,
"slop": 10
}
}
},
);
}
In our project we have file called EllascticHelper.js (So as I understand we do not use elasctic module, but we have some connection to elastic functionality, I presume via this in our config file
"database": {
"redis": {
"host": "0.0.0.0", //sorry here fake numbers
"port": 42456 //sorry here fake numbers
},
"elastic": {
"host": "0.0.0.0", //sorry here fake numbers
"port": 48359 //sorry here fake numbers
}
},
Так что я говорил о EllascticHelper.js файл, в этом файле я попытался скопировать реализацию поиска по встречному списку
plumbsList: [],
countersList: []
for(let counter of clientFacility.get('countersWcCurrent')){
let counterObject = counter amp;amp; counter.counterWcId ? (await CounterWc.findById(ConvertHelper.convertToMongoId(counter.counterWcId))) : '';
counterObject amp;amp; counterObject.get('infoCurrent') amp;amp; counterObject.get('infoCurrent.factoryNumber') ? obj.countersList.push(counterObject.get('infoCurrent.factoryNumber')) : '';
}
for(let counter of clientFacility.get('countersWcCurrent')){
let counterObject = counter amp;amp; counter.counterWcId ? (await CounterWc.findById(ConvertHelper.convertToMongoId(counter.counterWcId))) : '';
counterObject amp;amp; counterObject.get('facilityCurrent') amp;amp; counterObject.get('facilityCurrent.plumbNumber') ? obj.plumbsList.push(counterObject.get('facilityCurrent.plumbNumber')) : '';
}