0

我的 ElasticSearch 上有以下结构:

{
    _index: 3_exposureindex
    _type: exposuresearch
    _id: 12738
    _version: 4
    _score: 1
    _source: {
        Name: test2_update
        Description:
        CreateUserId: 8
        SourceId: null
        Id: 12738
        ExposureId: 12738
        CreateDate: 2014-06-20T16:18:50.500
        UpdateDate: 2014-06-20T16:19:57.547
        UpdateUserId: 8
    }
    fields: {
        _parent: 1
    }
}

当我运行查询时,我试图同时获取 in 和 in 中的数据_sourcefields

{
  "query": {
    "terms": {
      "Id": [
        "12738"
      ]
    }
  }
}

我得到的只是 中包含的值_source,而如果我运行查询:

{
  "fields": [
    "_parent"
  ],
  "query": {
    "terms": {
      "Id": [
        "12738"
      ]
    }
  }
}

那我只有fields. 有没有办法两者兼得?我将不胜感激任何帮助。

4

1 回答 1

1

您应该能够在“字段”中指定“_source”

例子:

{
  "fields": [
    "_parent",
    "_source"
  ],
  "query": {
    "terms": {
      "Id": [
        "12738"
      ]
    }
  }
}
于 2014-06-20T19:22:01.063 回答