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

Use actual index for validation instead of .kibana #2555

Closed
ahardy opened this issue Jan 7, 2015 · 9 comments
Closed

Use actual index for validation instead of .kibana #2555

ahardy opened this issue Jan 7, 2015 · 9 comments
Labels
bug Fixes for quality problems that affect the customer experience Feature:elasticsearch

Comments

@ahardy
Copy link

ahardy commented Jan 7, 2015

Following the basic parent/child setup here. ES 1.4.2 & K 4-beta3

  • Add parent-child mapping to index
PUT /parent-child
{
  "mappings": {
    "branch": {},
    "employee": {
      "_parent": {
        "type": "branch" 
      }
    }
  }
}
  • Index parent and child
PUT /parent-child/branch/london
{
  "name": "London Westminster", 
  "city": "London", 
  "country": "UK" 
}

PUT /parent-child/employee/1?parent=london
{
  "name":  "Alice Smith",
  "dob":   "1970-10-24"
}
  • Find parent by children
GET /parent-child/branch/_search
{
  "query": {
    "has_child": {
      "type": "employee",
      "query":  {"match_all": {} }
    }
  }
}
  • Find children by parent
GET /parent-child/employee/_search
{
  "query":{
  "has_parent": {
  "type": "branch", 
  "query": { 
    "match": {
      "country": "UK"
    }}}}}

All queries work as expected against Elasticsearch

  • Execute Json query within Kibana search box fails
{"has_child": {"type": "employee", "query":  {"match_all": {} }}}

error: "org.elasticsearch.index.query.QueryParsingException: [.kibana] [has_child] No mapping for for type [employee]"
index: ".kibana"
valid: false
{"has_parent": {"type": "branch", "query": { "match": {"country": "UK"}}}}
error: "org.elasticsearch.index.query.QueryParsingException: [.kibana] [has_parent] query configured 'parent_type' [branch] is not a valid type"
index: ".kibana"
valid: false
@rashidkpc rashidkpc changed the title JSON dsl query doesn't work for parent/child relationships Use actual index for validation instead of .kibana Jan 7, 2015
@rashidkpc rashidkpc added bug Fixes for quality problems that affect the customer experience help wanted adoptme labels Jan 7, 2015
@krijnmossel
Copy link

Had request for this functionality from Masai Technology.

@ajrasch
Copy link

ajrasch commented Mar 26, 2015

Is anyone working on this? Thanks!

@spalger
Copy link
Contributor

spalger commented Apr 9, 2015

It should be noted that the validator on the dashboard will need to validate against all of the indices that the filter will be included in. Unfortunately, we will need to validate each index pattern separately to ensure that queries run against the index patterns in isolation will not fail (for whatever reason) and the error messages will need to identify the index pattern they fail against.

@rashidkpc
Copy link
Contributor

There's an additional problem here. The query validator requires the index name be passed in the URL. This is fine for non-timestamp indices, but for timestamped indices we're going to end up with a really huge list of indices which is going to exceed the elasticsearch URL length limit

We COULD just get the first index in the list and only validate against that, but its a poor solution. If we are validating a complex query such as a geo or parent/child, and one of the indices in the list is missing the field, the query is going to fail and we're not going to know why.

On top of all that, the validator is a hack to make sure we don't fail all shards just because of a typo. We shouldn't even need it. The real solution here is to not even use the query validator, and fix the error messages in elasticsearch so we know why a request failed: elastic/elasticsearch#3303

@antcodd
Copy link

antcodd commented May 28, 2015

_validate appears to support wildcards in Multiple Indices syntax just fine, at least as of Elasticsearch 1.4.5. It simply returns an array of validation results, one for each matching index.

Why not just pass the index wildcard directly as the index name for now? There even seems to be some code for this in components/validate_query/validate_query.js, but no plumbing for $scope.queryInput. This would also have the benefit of checking field type mapping (a little care might be needed for scripted fields depending on how these work in Kibana).

This issue (along with #1084 and the lack of arbitrary custom aggregation JSON) severely limit the applications of Kibana by making it impossible, as far as I can tell, to visualize relationships in any manner without denormalizing every field on the dashboard.

@ajrasch
Copy link

ajrasch commented Jul 17, 2015

ANy progress on supporting has_parent and has_child filters in the recent Kibana versions?

@tbragin
Copy link
Contributor

tbragin commented Jul 30, 2015

As a result of not checking the actual index, the geo distance filter (and perhaps others) don't currently work, if you paste the Query DSL into the Kibana search bar:

{
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "geo_distance": {
          "distance": "200km",
          "coordinates": {
            "lat": 40,
            "lon": -70
          }
        }
      }
    }
  }

screen shot 2015-07-30 at 9 03 58 am

Here is the full DSL from Sense which works directly against Elasticsearch 1.6 ("geo.coordinates" field has type "geo_point").

GET logstash-2015.05.18/_search
{
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "geo_distance": {
          "distance": "200km",
          "coordinates": {
            "lat": 40,
            "lon": -70
          }
        }
      }
    }
  }
}

@philbb
Copy link

philbb commented Aug 28, 2015

I'm seeing the same problem with geohash_cell.
When I type the following into the Kibana search bar {"filtered":{"filter" : {"geohash_cell": {"location": "u33dd"}}}}
I get: QueryParsingException failed to find geo_point field [location]

@rashidkpc
Copy link
Contributor

Closing this as we've removed query validation now that elasticsearch 2.0 has structured errors.

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:elasticsearch
Projects
None yet
Development

No branches or pull requests

8 participants