Given a mapping and sample document below, I am trying to construct a
query, which would return facet information on the fields of the nested
objects (e.g., state.id or types.id). The mapping of serviceItem does not
used 'nested' type. How do I include a facet for "state.id" in the query.
When I include facets below, the one for 'launchUrl' returns results, while
the one for 'state.id' does not. How can obtain facet information on fields
of nested objects?
Thank you,
Michael
Facet fragment:
"facets": {
"tag1": {
"terms": {
"fields": [
"state.id"
]
}
},
"tag2": {
"terms": {
"fields": [
"launchUrl"
]
}
}
}
Mapping fragment:
serviceItem: {
- properties: {
- imageLargeUrl: {
- include_in_all: true
- index: not_analyzed
- type: string
}
- totalComments: {
- include_in_all: false
- type: integer
}
- launchUrl: {
- include_in_all: true
- index: not_analyzed
- type: string
}
- state: {
- properties: {
- id: {
- include_in_all: false
- index: no
- type: long
}
- ref: {
- include_in_all: false
- index: no
- type: string
}
- title: {
- include_in_all: true
- term_vector: with_positions_offsets
- type: string
}
- isPublished: {
- index: not_analyzed
- type: boolean
}
- class: {
- include_in_all: false
- index: no
- type: string
}
}
}
- id: {
- properties: {
- imageLargeUrl: {
A sample object:
{
- _index: marketplace
- _type: serviceItem
- _id: 73
- _version: 1
- _score: 1
- _source: {
- imageLargeUrl:
http://www.freeiconsweb.com/Icons-show/IconsExtra/Phone%20Blue.png - totalComments: 0
- launchUrl:
http://www.freeiconsweb.com/Icons-show/IconsExtra/Phone%20Blue.png - state: {
- id: 12
- class: marketplace.State
- isPublished: true
- title: Active
}
- editedDate: 2012-05-24T18:26:00.000Z
- totalRate5: 0
- screenshot2Url:
http://www.freeiconsweb.com/Icons-show/IconsExtra/Phone%20Blue.png - totalRate4: 0
- requirements: Req
- author: {
- id: 16
- class: marketplace.Profile
- avatar: null
- displayName: Michael Parizer Admin
- username: MikePAdmin
}
- organization: unknown
- avgRate: 0
- lastActivity: {
- id: 85
- class: marketplace.ModifyRelationshipActivity
- activityDate: 2012-05-24T18:25:59.000Z
- serviceItemVersion: 1
}
- title: Widget
- releaseDate: 2012-01-30T05:00:00.000Z
- totalRate2: 0
- totalRate3: 0
- dependencies: Dep
- description: test
- docUrl:
http://www.freeiconsweb.com/Icons-show/IconsExtra/Phone%20Blue.png - totalRate1: 0
- totalVotes: 0
- approvalStatus: Approved
- itemComments: [ ]
- types: {
- id: 58
- class: marketplace.Types
- hasIcons: true
- hasLaunchUrl: true
- image: null
- ozoneAware: true
- title: Widget
}
- techPoc: MikePAdmin
- screenshot1Url:
http://www.freeiconsweb.com/Icons-show/IconsExtra/Phone%20Blue.png - customFields: [ ]
- serviceItemActivities: [
- {
- id: 80
- class: marketplace.ServiceItemActivity
- activityDate: 2012-05-24T18:25:56.000Z
}
- {
- id: 85
- class: marketplace.ModifyRelationshipActivity
- activityDate: 2012-05-24T18:25:59.000Z
- serviceItemVersion: 1
}
]
- {
- versionName: 1
- approvedDate: null
- owfProperties: {
- id: 44
- class: marketplace.OwfProperties
- background: true
- singleton: true
- visibleInLaunch: true
}
- isHidden: 0
- installUrl:
http://www.freeiconsweb.com/Icons-show/IconsExtra/Phone%20Blue.png - categories: [
- {
- id: 24
- class: marketplace.Category
- title: Category C
}
- {
- id: 12
- class: marketplace.Category
- title: Category A
}
- {
- id: 33
- class: marketplace.Category
- title: Geospatial
}
- {
- id: 18
- class: marketplace.Category
- title: Category B
}
- {
- id: 47
- class: marketplace.Category
- title: Query
}
- {
- id: 52
- class: marketplace.Category
- title: Reporting
}
- {
- id: 57
- class: marketplace.Category
- title: Temporal
}
]
- {
- uuid: 02c71e13-aa1e-466c-b3e3-65c2602c4e3d
- imageSmallUrl:
http://www.freeiconsweb.com/Icons-show/IconsExtra/Phone%20Blue.png
}
- imageLargeUrl:
}