2016-06-19 8 views
0

JavaScript/Node APIでマルチ検索(msearch)を使用すると、ElasticSearch 2.3のソースフィルタ機能が動作しない場合があります。 _sourceInclude、_source_include、_source:{include: 'specificField'}、[specificField]の代わりに['specificField']のような異なる組み合わせを試しました。ElasticSearchソースフィルタリングがマルチ検索JavaScript/Node APIで常に機能しない

ヒント?

params.searches = [ { _type: 'Doc', _source: 'specificField' }, {query: {constant_score: {filter: {bool: {must: [ {term: {id: params.id}}, {term: {anotherField: false}} ]}}}}}, ];

答えて

0

ソースindextype

とクエリとしないとともに指定する必要があります

params.searches = [ 
    {"index":"test", "_type":"Doc"}, 
    { 
    "_source": [ 
     "specificField" 
     ], 
    "query": { 
     "constant_score": { 
     "filter": { 
      "bool": { 
      "must": [ 
      { 
       "term": { 
       "id": "params.id" 
       } 
      }, 
      { 
       "term": { 
       "anotherField": "false" 
       } 
      } 
      ] 
     } 
     } 
    } 
    } 
    } 
] 
関連する問題