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

Advanced setting to show fields regardless of conflict type #14937

Closed
alexfrancoeur opened this issue Nov 14, 2017 · 9 comments
Closed

Advanced setting to show fields regardless of conflict type #14937

alexfrancoeur opened this issue Nov 14, 2017 · 9 comments
Labels
enhancement New value added to drive a business result Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@alexfrancoeur
Copy link

In 5.5 we no longer show field conflicts for "like" types and allow you to select a field for a visualization that resolve to the same Kibana type. This is best described in this comment #13070 (comment)

Today, Kibana will not allow you to select a field for a visualization if there is any kind of conflict. While the adjustments made in 5.5 makes this experience a bit better, there are still scenarios in which field conflicts occur for dissimilar types. For example a field who had text type and the mapping changed to integer.

We should provide an outlet for users to override the assumptions Kibana makes about field types. If there is a conflict, a user should be able to toggle an advanced setting to ignore these conflicts and allow a user to select this field regardless. If the visualization attempted to aggregate on a non-supported or conflicted type, Elasticsearch should throw an error and surface this in Kibana.

@alexfrancoeur alexfrancoeur added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Nov 14, 2017
@alexfrancoeur
Copy link
Author

cc: @epixa @ppf2 @spalger @chrisronline

@chrisronline
Copy link
Contributor

There might be a possible workaround that involves using scripted fields.

Consider the following dataset:

PUT my-data-2017-11-13
{
  "mappings": {
    "doc": {
      "properties": {
        "name": {
          "type": "text"
        },
        "time": {
          "type": "date"
        },
        "count": {
          "type": "keyword"
        }
      }
    }
  }
}
PUT my-data-2017-11-14
{
  "mappings": {
    "doc": {
      "properties": {
        "name": {
          "type": "text"
        },
        "time": {
          "type": "date"
        },
        "count": {
          "type": "integer"
        }
      }
    }
  }
}
PUT my-data-2017-11-15
{
  "mappings": {
    "doc": {
      "properties": {
        "name": {
          "type": "text"
        },
        "time": {
          "type": "date"
        },
        "count": {
          "type": "integer"
        }
      }
    }
  }
}

POST my-data-2017-11-13/doc
{
  "name": "Michael Scott",
  "time": "2017-11-13T14:00:48.365Z",
  "count": "2"
}

POST my-data-2017-11-14/doc
{
  "name": "Jim Halpert",
  "time": "2017-11-14T14:00:48.365Z",
  "count": 3
}

POST my-data-2017-11-15/doc
{
  "name": "Pam Beesley",
  "time": "2017-11-15T14:00:48.365Z",
  "count": 4
}

If I created an index pattern my-data-*, I'd see a mapping conflict for count. However, I can create a scripted field using:

try {
  return Integer.parseInt(doc['count'].value);
}
catch (Exception e) {
  return doc['count'].value;
}

I can now use that scripted field to build visualizations, dashboards, etc.

@alexfrancoeur
Copy link
Author

Thanks @chrisronline. While this is certainly possible, it's definitely not ideal. The purpose of this issue is to have the option natively in Kibana. For anyone looking to solve this issue today, @chrisronline's comment above is a workaround today

@epixa
Copy link
Contributor

epixa commented Nov 15, 2017

To be clear, what @chrisronline posted and what we're proposing to add to Kibana are apples and oranges. The proposal in Kibana is to give people the ability to opt out of assumptions Kibana makes based on field types and just let people try to do whatever they want to any field, which is a considerably worse experience than seamlessly handling the conflicts in the query itself, which is what the scripted field is doing.

@ppf2
Copy link
Member

ppf2 commented Dec 6, 2017

If there are documents without the field (or multiple indices in the index pattern where one or more indices do not contain the field), the workaround script will fail at the ES level, so I have added a pre-check to it:

if (doc.containsKey('count')) {
try {
  return Integer.parseInt(doc['count'].value);
}
catch (Exception e) {
  return doc['count'].value;
}
}

@alexfrancoeur
Copy link
Author

@chrisronline @spalger @epixa is this still something we plan to address in a 6.x release? I remember some early brainstorm conversations around this and have heard similar requests from some of our larger customers. Think we can revisit?

@epixa
Copy link
Contributor

epixa commented Feb 6, 2018

@alexfrancoeur I think it's probably too early to tell.

@epixa epixa added enhancement New value added to drive a business result and removed release_note:enhancement labels May 7, 2018
@epixa epixa added Team:Visualizations Visualization editors, elastic-charts and infrastructure and removed Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Oct 16, 2018
@ppf2
Copy link
Member

ppf2 commented Dec 4, 2018

This is another example of a type conflict Kibana does not handle today (concrete vs. object field): #26583

@stratoula
Copy link
Contributor

Thank you for contributing to this issue, however, we are closing this issue due to inactivity as part of a backlog grooming effort. If you believe this feature/bug should still be considered, please reopen with a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

5 participants