ES常见操作


1、ES查询某个字段不为空:
POST uc_user_info_yc/default/_search 
{
  "query": {
    "exists": {
      "field": "residentCode"
    }
  }
}
2、根据条件更新数据:
POST index_name/_update_by_query
{
  "query": {
    "match": {
      "条件": "8fe6e9b2a9330862"
    }
  },
  "script": {
    "source": "ctx._source['column'] = params['one']",
    "params": {
      "one": "修改后的值"
    }
  }
}

示例:
POST xxxx_company/_update_by_query
{
  "query": {
    "match": {
      "_id": "8fe6e9b2a9330862"
    }
  },
  "script": {
    "source": "ctx._source['eps'] = params['one']",
    "params": {
      "one": {
        "value": 1.0,
        "value_usd": 1.1
      }
    }
  }
}
3、查询设置信息
GET /index_name/_settings 
ES默认最多查询一万条,也可以修改默认值
PUT /index_name/_settings 
{"index":{"max_result_window" : 100000}}

你可能感兴趣的:(ES,elasticsearch,java,windows)