Я работаю над поисковым приложением на основе Angular7 иasticsearchJS.В моем сервисе данных я создаю JS-файл Elaset Flexible Search из входных данных пользователя.Это хорошо работает с простым строковым запросом в this.query.Это не будет работать для сложного массива из this.selectedTopics (мои флажки).Вывод уничтожен в JSON (см. Изображение)

Я становлюсь обратной косой чертой в моем console.log по моему запросу (см. Изображение)
console.log(this.selectedTopics);
// Output of selectedTopics is this:
// ["Lindenholz", "Sandstein"]
this.selectedTopics.forEach( (item) => {
this.termarray.push('{ "term": {"79_material":"' + item + '"}}');
});
console.log(this.termarray.join(', '));
// Output of termarray is this:
//
// [
// { "term": {"79_material":"Sandstein"}},
// { "term": {"79_material":"Lindenholz"}}
// ]
// looks fine in console. But if i send the termarray to the json body it looks wrong with the backslashes.
this.body = {
// 'size': this.size.value, // document anzahl
'size': '100',
'from': '0', // page
'query': {
'filtered': {
'query' : {
'multi_match': {
'query': this.query,
'type': 'phrase_prefix',
// 'fields': ['79_material', '79_technik'] // Fulltext or Category
'fields': this.selectedCategory
}
},
'filter': {
'bool': {
'must': [
this.termarray.join(', ')
// {'term' : { '79_material': 'holz' }},
// {'term' : { '79_material': 'lindenholz' }}
]
}
}
}
},
// Faceten Auswahl hier und in der Searchlist. Auf content und keyword achten.
'facets' : {
'79_material' : {
'terms' : {'field' : '79_material.keyword'}
},
'79_technik' : {
'terms' : {'field' : '79_technik.keyword'}
},
'79_kuenstler' : {
'terms' : {'field' : '79_kuenstler.content'} // neue Indexierung mit Keyword
},
'79_verortung' : {
'terms' : {'field' : '79_verortung.content'} // neue Indexierung mit Keyword
},
},
'sort' : [
{ '79_material' : {'order' : 'asc'}},
'_score'
]
};

Результат должен быть таким:
[
{'term' : { '79_material': 'holz' }},
{'term' : { '79_material': 'lindenholz' }}
]