Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discover shows whole json object #15951

Closed
dosera opened this issue Jan 10, 2018 · 16 comments
Closed

Discover shows whole json object #15951

dosera opened this issue Jan 10, 2018 · 16 comments
Labels
bug Fixes for quality problems that affect the customer experience Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@dosera
Copy link

dosera commented Jan 10, 2018

I just noticed - after upgrading heartbeat from 5.x to 6.x - hat the discover view displays a whole json object as a string instead of the simple fields.

Following scenario:

I have an index pattern with

  • monitor - string [this is the legacy field for 5.6, when monitor was a string]
  • monitor.duration.us - number
  • monitor.host - string
  • monitor.ip - string
  • ....

When looking at the discover view, it looks like this:
34763514-ca87da62-f5eb-11e7-96b1-866b39d22802

I would expect - since monitor is no string here - one entry per field, e.g.

"monitor.name": "name"
"monitor.id": "id"
...

@Bargs
Copy link
Contributor

Bargs commented Jan 10, 2018

Strange. What does your mapping for the monitor field look like? Also what does the monitor field look like on the JSON tab?

screen shot 2018-01-10 at 10 48 49 am

@dosera
Copy link
Author

dosera commented Jan 11, 2018

Mapping for the monitor field:
GET _template/metrics-heartbeat

"monitor": {
    "properties": {
        "duration": {
            "properties": {
                "us": {
                    "type": "long"
                }
            }
        },
        "host": {
            "ignore_above": 1024,
            "type": "keyword"
        },
        "id": {
            "ignore_above": 1024,
            "type": "keyword"
        },
        "ip": {
            "ignore_above": 1024,
            "type": "keyword"
        },
        "name": {
            "ignore_above": 1024,
            "type": "keyword"
        },
        "scheme": {
            "ignore_above": 1024,
            "type": "keyword"
        },
        "status": {
            "ignore_above": 1024,
            "type": "keyword"
        },
        "type": {
            "ignore_above": 1024,
            "type": "keyword"
        }
    }
}

Used to be

"monitor": {
    "type": "keyword"
}

The monitor in the JSON tab:

"monitor": {
    "name": "name",
    "id": "id",
      "duration": {
        "us": 1616
      },
      "type": "tcp",
      "host": "dev",
      "scheme": "tcp"
}

Regards

@Bargs
Copy link
Contributor

Bargs commented Jan 11, 2018

What does Kibana show as the "type" of the monitor field on the index pattern management page? You should be able to see the sub-fields listed here as well (e.g. monitor.name). If monitor was once mapped as a keyword I wonder if Kibana still thinks it's a string. If that's the case, you can just refresh the field list by clicking the refresh button on that page.

@dosera
Copy link
Author

dosera commented Jan 12, 2018

monitor has the type string; the subfields are for example monitor.duration.us=number, monitor.host=string etc.

If that's the case, you can just refresh the field list by clicking the refresh button on that page.

That I did of course, but it doesnt change a thing. I guess it may be due to the legacy data.

@Bargs
Copy link
Contributor

Bargs commented Jan 16, 2018

Yes, if you have old indices with different mappings for monitor, this will cause troubles in Kibana.

@Bargs
Copy link
Contributor

Bargs commented Jan 16, 2018

Does Kibana say anything about the field having a mapping conflict on the management screen? I'd be surprised if it didn't.

@dosera
Copy link
Author

dosera commented Jan 18, 2018

Does Kibana say anything about the field having a mapping conflict on the management screen? I'd be surprised if it didn't.

It doesnt.

@Bargs
Copy link
Contributor

Bargs commented Mar 26, 2018

Ok, so after much delay I had some time to try to reproduce this. It was pretty easy following the info @dosera provided above. I created two indices, one where monitor is mapped as a keyword and another where monitor is an object. I created an index pattern matching both and when I look at it in Discover I'm seeing the same behavior @dosera described. I haven't looked at the code, but apparently having monitor listed as type string in the index pattern is throwing things off. It's a bit of an odd configuration since it would only show up when you have indices with heterogeneous mappings. That said, I bet we could handle it more gracefully.

Here are the Console requests I used, in case anyone wants to quickly reproduce this and take a swing at fixing it:

PUT object-string
{
  "mappings": {
    "doc": {
      "properties": {
        "monitor": {
          "type": "keyword"
        }
      }
    }
  }
}

PUT object-object
{
  "mappings": {
    "doc": {
      "properties": {
        "monitor": {
          "properties": {
            "duration": {
              "properties": {
                "us": {
                  "type": "long"
                }
              }
            },
            "host": {
              "ignore_above": 1024,
              "type": "keyword"
            },
            "id": {
              "ignore_above": 1024,
              "type": "keyword"
            },
            "ip": {
              "ignore_above": 1024,
              "type": "keyword"
            },
            "name": {
              "ignore_above": 1024,
              "type": "keyword"
            },
            "scheme": {
              "ignore_above": 1024,
              "type": "keyword"
            },
            "status": {
              "ignore_above": 1024,
              "type": "keyword"
            },
            "type": {
              "ignore_above": 1024,
              "type": "keyword"
            }
          }
        }
      }
    }
  }
}


POST object-object/doc
{
  "monitor": {
    "name": "name",
    "id": "id",
    "duration": {
      "us": 1616
    },
    "type": "tcp",
    "host": "dev",
    "scheme": "tcp"
  }
}

POST object-string/doc
{
  "monitor": """{"name":"name","id":"id","duration":{"us":1616},"type":"tcp","host":"dev","scheme":"tcp"}"""
}

@Bargs Bargs added bug Fixes for quality problems that affect the customer experience and removed feedback_needed labels Mar 26, 2018
@tsg
Copy link
Contributor

tsg commented Sep 11, 2018

This ES ticket is related and I think required to solve this one: elastic/elasticsearch#33237

@timroes timroes added Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure and removed :Discovery labels Sep 16, 2018
@darkmoon03
Copy link

I have the same issue, without having the heterogeneous objects. I can delete the index completely and it gets recreated with the proper mappings, but shows in Discover as json blobs only.

@darkmoon03
Copy link

Mapping:
` "meta": {
"dynamic": "true",
"properties": {
"delay": {
"type": "integer"
},
"filter": {
"type": "keyword"
},
"filterhost": {
"type": "keyword"
},
"filtertime": {
"type": "long"
},

etc...
`

In Discover:
{ "type": "syslog", "target": { "topic": "logqueue-pprd", "index": "log_syslog-2019.05.07" }, "queuehost": [ "logqueue-prod-03", "logqueue-pprd-01" ], "queuetime": 1557256848, "filter": [ "20-syslog-base", "78-category" ], "input": [ "beats", "prodsample" ], "size": 107, "filtertime": 1557256850, "delay": 8, "filterhost": "logfilter-pprd-02.cas-1.cls.vt.edu" }

Before deleting and recreating indices (to fix the API/FORBIDDEN issue), these all showed as individual fields. Same versions of everything.

@darkmoon03
Copy link

Kibana is adding an extraneous entry for the object itself when it creates the index pattern. Removing this manually fixes that object, but it comes back if you refresh the pattern.

Clearly a bug in Kibana's index pattern creation. Can we get a fix, please?

@darkmoon03
Copy link

Please, does anyone know how to make Kibana display objects properly, again?

@darkmoon03
Copy link

https://www.elastic.co/guide/en/kibana/6.7/document-data.html#adding-columns

You can see an example here of what should be happening.

Here's the documentation for the elastic mapping:
https://www.elastic.co/guide/en/elasticsearch/reference/6.7/object.html

@Bargs
Copy link
Contributor

Bargs commented Jun 4, 2019

@darkmoon03 could you provide exact steps to reproduce? When I look at a basic object field in Discover I'm still seeing the individual subfields correctly.

@timroes
Copy link
Contributor

timroes commented Feb 23, 2021

Fixed via #83891

@timroes timroes closed this as completed Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

5 participants