Searchlight UI: Facets don't work on deep object mapped fields

Bug #1621289 reported by Travis Tripp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Searchlight
Fix Released
High
Steve McLellan

Bug Description

Hypervisor has a deeply nested object. cpu_info.* and cpu_info.topology.*

http://paste.openstack.org/show/568735/

The following code:

https://github.com/openstack/searchlight-ui/blob/aa6491204b157abb7e86a9553bd052e800553e2e/searchlight_ui/static/searchlight-ui/util/searchlight-query-utils.service.js#L196-L206

Assumes it is nested and generates this:

{
 "query": {
  "bool": {
   "must": [{
    "nested": {
     "path": "cpu_info",
     "query": {
      "query_string": {
       "fields": ["cpu_info.model"],
       "query": "SandyBridge"
      }
     }
    }
   }]
  }
 },
 "all_projects": true,
 "limit": 200,
 "sort": [{
  "_score": {
   "order": "desc"
  }
 }],
 "type": ["OS::Nova::Hypervisor"],
 "version": true
}

BUT it may not be nested: See https://review.openstack.org/#/c/364533/

This results in an error when submitting the query.

And the query changes to:

{
 "query": {
  "bool": {
   "must": [{
    "query_string": {
     "fields": ["cpu_info.model"],
     "query": "SandyBridge"
    }
   }]
  }
 },
 "all_projects": true,
 "limit": 200,
 "sort": [{
  "_score": {
   "order": "desc"
  }
 }],
 "type": ["OS::Nova::Hypervisor"],
 "version": true
}

Based on the above patch, we shouldn't be assuming nested. And in addition, the UI does not have knowledge to determine whether or not it should be using a nested query or if a standard object path query should work.

I think we should change the UI to assume it is object path... but in a separate patch, we need to know whether or not a facet should be queried using nested or object syntax.

Right now the facet "Type" lies. It flattens them.

      {
        "type": "string",
        "name": "cpu_info.model"
      },
      {
        "type": "string",
        "name": "cpu_info.vendor"
      },
      {
        "type": "string",
        "name": "cpu_info.features"
      },
      {
        "type": "integer",
        "name": "cpu_info.topology.cores"
      },

Changed in searchlight:
importance: Undecided → High
milestone: none → newton-rc1
tags: added: searchlight-ui
description: updated
description: updated
summary: - Searchlight UI: Facets don't work on deep fields
+ Searchlight UI: Facets don't work on deep object mapped fields
description: updated
Revision history for this message
Steve McLellan (sjmc7) wrote :

My suggestion for fixing this is to add a flag to 'dot' fields indicating whether or not they're nested; we can't use 'type':'nested' because we flatten the structure. This'd allow the UI to make the decision, and if we decide to expose the full mapping in Ocata maybe that's a better longer term solution. I'll put up a patch.

Steve McLellan (sjmc7)
Changed in searchlight:
assignee: nobody → Steve McLellan (sjmc7)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to searchlight-ui (master)

Reviewed: https://review.openstack.org/367044
Committed: https://git.openstack.org/cgit/openstack/searchlight-ui/commit/?id=b39ecef73ac042e4b43e5f2e8e8d012e66255e87
Submitter: Jenkins
Branch: master

commit b39ecef73ac042e4b43e5f2e8e8d012e66255e87
Author: Travis Tripp <email address hidden>
Date: Wed Sep 7 19:45:08 2016 -0600

    Default handling of paths to objects

    We can't tell if an object is nested or is an object.
    Previously, we used nested as the default best guess.
    Now we need to use object syntax. The service really
    needs to tell UI if a field is nested or not. This is
    intended to deal with the ramifications of:

    I35cb9b43d4281c2cabdb602bf64af096ca4b9955

    Change-Id: I6102fa26450c255707008ba9388f29b2bd839abe
    Closes-Bug: #1621289
    Depends-On: I35cb9b43d4281c2cabdb602bf64af096ca4b9955

Changed in searchlight:
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to searchlight (master)

Fix proposed to branch: master
Review: https://review.openstack.org/367645

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to searchlight-ui (master)

Fix proposed to branch: master
Review: https://review.openstack.org/367677

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to searchlight (master)

Reviewed: https://review.openstack.org/367645
Committed: https://git.openstack.org/cgit/openstack/searchlight/commit/?id=4ca188e7d6dccb8bdc10fe19547fb9c4dd371412
Submitter: Jenkins
Branch: master

commit 4ca188e7d6dccb8bdc10fe19547fb9c4dd371412
Author: Steve McLellan <email address hidden>
Date: Thu Sep 8 16:39:39 2016 -0500

    Indicate 'nested' on facet types

    For nested/object property types, indicate whether they are nested
    so that the UI can make decisions for querying.

    Facets now have an attribute 'nested' for multi-level types.

    Change-Id: If4200fdff2db7bef49843a3ff611fc4edf2eea58
    Partial-Bug: #1621289

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/searchlight-ui 1.0.0.0rc1

This issue was fixed in the openstack/searchlight-ui 1.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to searchlight-ui (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/379039

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to searchlight-ui (master)

Reviewed: https://review.openstack.org/367677
Committed: https://git.openstack.org/cgit/openstack/searchlight-ui/commit/?id=0704a1af817d90b5086bd7d49dfdbb409a62e005
Submitter: Jenkins
Branch: master

commit 0704a1af817d90b5086bd7d49dfdbb409a62e005
Author: Steve McLellan <email address hidden>
Date: Thu Sep 8 17:28:04 2016 -0500

    Honor 'nested' in facets

    If a facet field is marked 'nested' use a nested query type, otherwise
    treat is as any other field. This patch adds 'nested' to the
    magicsearch facet objects, and passes the entire facet definition
    to the query build function (as well as the selected key/value pair).

    Change-Id: I628691d93c4d864964e53e2c1fb69c796868db1f
    Partial-Bug: #1621289
    Depends-On: If4200fdff2db7bef49843a3ff611fc4edf2eea58

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to searchlight-ui (stable/newton)

Reviewed: https://review.openstack.org/379039
Committed: https://git.openstack.org/cgit/openstack/searchlight-ui/commit/?id=24894a16e56b9e1a3dd113ab0db1543d7210c8bf
Submitter: Jenkins
Branch: stable/newton

commit 24894a16e56b9e1a3dd113ab0db1543d7210c8bf
Author: Steve McLellan <email address hidden>
Date: Thu Sep 8 17:28:04 2016 -0500

    Honor 'nested' in facets

    If a facet field is marked 'nested' use a nested query type, otherwise
    treat is as any other field. This patch adds 'nested' to the
    magicsearch facet objects, and passes the entire facet definition
    to the query build function (as well as the selected key/value pair).

    Change-Id: I628691d93c4d864964e53e2c1fb69c796868db1f
    Partial-Bug: #1621289
    Depends-On: If4200fdff2db7bef49843a3ff611fc4edf2eea58

tags: added: in-stable-newton
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/searchlight-ui 1.0.0.0rc1

This issue was fixed in the openstack/searchlight-ui 1.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.