elasticsearch,Javascript,Typescript,elasticsearch" /> elasticsearch,Javascript,Typescript,elasticsearch" />

ElasticSearchJavaScript SDK-

ElasticSearchJavaScript SDK-,javascript,typescript,elasticsearch,Javascript,Typescript,elasticsearch,我有以下代码: import * as es from '@elastic/elasticsearch'; const c = new es.Client({node: 'http://ec2-xx-222-xx-107.us-west-2.compute.amazonaws.com:9200'}); client.search({ index: 'foo', body: { value: true } }).then(v => {

我有以下代码:

 import * as es from '@elastic/elasticsearch';

 const c = new es.Client({node: 'http://ec2-xx-222-xx-107.us-west-2.compute.amazonaws.com:9200'});

 client.search({
    index: 'foo',
    body: {
      value: true
    }
  }).then(v => {
    log.info(v.body.hits);
  });
我得到了这个错误:

ResponseError:正在分析\u异常
在收到消息时。(/Users/alex/codes/interos/@interos/elastic search/node_modules/@elastic/elasticsearch/lib/Transport.js:287:25)
在IncomingMessage.emit(events.js:208:15)
在endReadableNT(_stream_readable.js:1154:12)
在处理和拒绝时(内部/process/task_queues.js:77:11)

不清楚为什么会发生错误,有人知道为什么吗?

您可以尝试执行此操作并粘贴错误
client.search({index:'foo',body:{value:true},(err,{body})=>{if(err)console.log(err)}
这可能是“value”中的错误不是Elasticsearch JSON body中的有效属性。所以一个名为“value”的键不是洁食键?似乎很奇怪,它不允许所有操作。您可以尝试执行此操作并粘贴错误
client.search({index:'foo',body:{value:true},(err,{body})=>{if(err)console.log(err)})
这可能是由于“value”不是Elasticsearch JSON body中的有效属性而导致的错误。因此,一个名为“价值”不是犹太教吗?似乎很奇怪,它不允许一切
ResponseError: parsing_exception
    at IncomingMessage.<anonymous> (/Users/alex/codes/interos/@interos/elastic-search/node_modules/@elastic/elasticsearch/lib/Transport.js:287:25)
    at IncomingMessage.emit (events.js:208:15)
    at endReadableNT (_stream_readable.js:1154:12)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)