karmada icon indicating copy to clipboard operation
karmada copied to clipboard

fix opensearch mapper_parsing_exception

Open fly2F opened this issue 2 years ago • 6 comments

karmada-search error log: Could not dynamically add mapping for field [app.name]. Existing mapping for [metadata.labels.app] must be of type object but found [text].

Co-authored-by: liys87x [email protected] Signed-off-by: huntsman_ly [email protected]

What type of PR is this? /kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes: Fixes #2335

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


fly2F avatar Aug 11 '22 07:08 fly2F

Example of mapper_parsing_exception error generated under dynamic mapping

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx:alpine
        name: nginx
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.name: nginx1
  name: nginx1
spec:
  replicas: 3
  selector:
    matchLabels:
      app.name: nginx1
  template:
    metadata:
      labels:
        app.name: nginx1
    spec:
      containers:
      - image: nginx:alpine
        name: nginx1

fly2F avatar Aug 11 '22 07:08 fly2F

/cc @wuyingjun-lucky Can you help take a look and have a test?

OK, I will finish it this weekend. /assign

wuyingjun-lucky avatar Aug 11 '22 12:08 wuyingjun-lucky

I have tested it works well on my side @XiShanYongYe-Chang. image I am not sure whether it will have an effect on query actions like labelselector if we change flattened to object and set it to false although it seems we have not implement query actions on opensearch backend.
Leave it to you @liys87x @RainbowMango @XiShanYongYe-Chang.

wuyingjun-lucky avatar Aug 13 '22 09:08 wuyingjun-lucky

opensearch does not support flattened https://github.com/opensearch-project/OpenSearch/issues/1018

fly2F avatar Aug 13 '22 09:08 fly2F

opensearch does not support flattened opensearch-project/OpenSearch#1018

OK looks good to me cc @XiShanYongYe-Chang

wuyingjun-lucky avatar Aug 13 '22 09:08 wuyingjun-lucky

@wuyingjun-lucky Thanks a lot!

XiShanYongYe-Chang avatar Aug 15 '22 01:08 XiShanYongYe-Chang

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XiShanYongYe-Chang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

karmada-bot avatar Aug 22 '22 12:08 karmada-bot