zipkin链路数据通过elasticsearch查询二

 索引映射:

{
    "version":9,
    "mapping_version":3,
    "settings_version":1,
    "aliases_version":1,
    "routing_num_shards":640,
    "state":"open",
    "settings":{
        "index":{
            "routing":{
                "allocation":{
                    "include":{
                        "_tier_preference":"data_content"
                    }
                }
            },
            "number_of_shards":"5",
            "provided_name":"zipkin-span-2023-02-03",
            "creation_date":"1675382400366",
            "requests":{
                "cache":{
                    "enable":"true"
                }
            },
            "number_of_replicas":"1",
            "uuid":"zRkKKjQRQhCyScP0BOjpdA",
            "version":{
                "created":"7160199"
            }
        }
    },
    "mappings":{
        "_doc":{
            "_source":{
                "excludes":[
                    "_q"
                ]
            },
            "dynamic_templates":[
                {
                    "strings":{
                        "mapping":{
                            "norms":false,
                            "ignore_above":256,
                            "type":"keyword"
                        },
                        "match_mapping_type":"string",
                        "match":"*"
                    }
                }
            ],
            "properties":{
                "traceId":{
                    "type":"keyword"
                },
                "shared":{
                    "type":"boolean"
                },
                "timestamp_millis":{
                    "format":"epoch_millis",
                    "type":"date"
                },
                "kind":{
                    "ignore_above":256,
                    "type":"keyword"
                },
                "annotations":{
                    "type":"object",
                    "enabled":false
                },
                "parentId":{
                    "ignore_above":256,
                    "type":"keyword"
                },
                "tags":{
                    "type":"object",
                    "enabled":false
                },
                "duration":{
                    "type":"long"
                },
                "remoteEndpoint":{
                    "dynamic":"false",
                    "properties":{
                        "serviceName":{
                            "type":"keyword"
                        }
                    }
                },
                "_q":{
                    "type":"keyword"
                },
                "localEndpoint":{
                    "dynamic":"false",
                    "properties":{
                        "serviceName":{
                            "type":"keyword"
                        }
                    }
                },
                "name":{
                    "type":"keyword"
                },
                "id":{
                    "ignore_above":256,
                    "type":"keyword"
                },
                "timestamp":{
                    "type":"long"
                }
            }
        }
    },
    "aliases":[

    ],
    "primary_terms":{
        "0":1,
        "1":1,
        "2":1,
        "3":1,
        "4":1
    },
    "in_sync_allocations":{
        "0":[
            "3sy0VUOzTJ6rCgSsIxBotg"
        ],
        "1":[
            "-LVpuB7yS72ZsRxp1zXjFA"
        ],
        "2":[
            "eTFeYAyYQ9mDqNi8LMH41A"
        ],
        "3":[
            "KmCnWZC6SP2RjcGYS5R5dQ"
        ],
        "4":[
            "r92wshYeRHeaVqpQDigeRw"
        ]
    },
    "rollover_info":{

    },
    "system":false,
    "timestamp_range":{
        "unknown":true
    }
}

目标:同样是查询  tags下的  gisq_request_id     

查询问题:

为什么同一条数据,通过不同的字段查询的数据结果不一样(一个有数据,一个没有数据)

方式一:通过traceId类型为keyword查询得出如下结果

 方式二:通过tags下gisq_request_id的类型,其中tags的类型定义为Object查询得出如下结果

问题原因:

   主要与索引映射设置的属性相关,通过索引映射可以发现tags定义的类型为Object,且还设置了enabled的false

问题总结 :

1.对于属性类型是Object,如果设置了enabled为false表示该字段类型不能够被索引(搜索)

2.对于已经创建的索引映射,不能在通过请求命令去修改映射属性值

参考如下:

Elasticsearch 重要mapping参数详解(三)_trayvontang的博客-CSDN博客_es中mapping的enable

猜你喜欢

转载自blog.csdn.net/qq_38423256/article/details/128903630
今日推荐