场景:
在ES库中含有对象Object类型的数据,查找了好久也没有找到相关的查询方法,特此记录一下
需求:
根据tags中的参数gisq_request_id参数的值获取相关的文档数据。
创建索引:
请求头
PUT http://192.168.100.88:9200/my_index
请求体:
{
"mappings": {
"my_type": {
"properties": {
"user":{
"type": "nested",
"properties": {
"first":{"type":"keyword"},
"last":{"type":"keyword"}
}
},
"tags":{
"type":"object",
"properties": {
"gisq_request_id":{
"type":"keyword"
}
}
},
"group":{
"type": "keyword"
}
}
}
}
}
插入测试数据:
请求头
PUT http://192.168.100.88:9200/my_index/my_type/1
请求体:
{
"group":"GuangZhou",
"user":[
{
"first":"Li",
"