ES的_source字段

2019-08-10  本文已影响0人  秦汉邮侠

简介

用途

保留还是不保留

样例

PUT tweets
{
  "mappings": {
    "_source": {
      "enabled": false
    }
  }
}

DELETE logs

PUT logs
{
  "mappings": {
    "_source": {
      "includes": [
        "*.count",
        "meta.description",
        "meta.other.*"
      
      ],
      "excludes": [
          "meta.*"
      ]
    }
  }
}

PUT logs/_doc/1
{
  "requests": {
    "count": 10,
    "foo": "bar" 
  },
  "meta": {
    "name": "Some metric",
    "description": "Some metric description", 
    "other": {
      "foo": "one", 
      "baz": "two" 
    }
  }
}

GET logs/_search
{
  "query": {
    "match": {
      "meta.other.foo": "one" 
    }
  }
}

使用说明

上一篇 下一篇

猜你喜欢

热点阅读