updated search query for elasticsearch. value is stored as a nested o… #48

Merged
tiger5226 merged 1 commit from search_updates into master 2018-03-09 16:47:28 +01:00

View file

@ -26,6 +26,45 @@ function getResults (input) {
index : 'claims',
_source: ['name', 'value', 'claimId'],
body : {
'query': {
'bool': {
'should': [
{
'match': {
'name^100': '*' + input.s.trim() + '*',
},
},
{
'nested': { // Need nested query because value is a nested object on the elastic document
'path' : 'value',
'query': {
'bool': {
'should': [
{
'match': {
'value.stream.metadata.title': '*' + input.s.trim() + '*',
},
},
{
'match': {
'value.stream.metadata.author': '*' + input.s.trim() + '*',
},
},
{
'match': {
'value.stream.metadata.description': '*' + input.s.trim() + '*',
},
},
],
},
},
},
},
],
},
},
},
/* body : {
'query': {
'bool': {
'must': {
@ -43,7 +82,7 @@ function getResults (input) {
},
size: input.size,
from: input.from,
},
}, */
});
}