The source filtering feature of ElasticSearch 2.3 does not always work when used with multi search (msearch) in JavaScript/Node API. I tried different combinations like _sourceInclude, _source_include, _source: {include: 'specificField'}, and also ['specificField'] instead of 'specificField'.
Any clue?
params.searches = [
{
_type: 'Doc',
_source: 'specificField'
},
{query: {constant_score: {filter: {bool: {must: [
{term: {id: params.id}},
{term: {anotherField: false}}
]}}}}},
];
The source should be specified along with the query and not with the index
and type
Example:
params.searches = [
{"index":"test", "_type":"Doc"},
{
"_source": [
"specificField"
],
"query": {
"constant_score": {
"filter": {
"bool": {
"must": [
{
"term": {
"id": "params.id"
}
},
{
"term": {
"anotherField": "false"
}
}
]
}
}
}
}
}
]