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"
}
}
]
}
}
}
}
}
]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.