Skip to content

Instantly share code, notes, and snippets.

@Hounddog
Last active August 29, 2015 14:24
Show Gist options
  • Save Hounddog/8c58cd94d54e5adb629b to your computer and use it in GitHub Desktop.
Save Hounddog/8c58cd94d54e5adb629b to your computer and use it in GitHub Desktop.
{
"_index":"cards",
"_type":"card",
"_id":"1",
"_score":1.0,
"_source":{
"id":2,
"givenName":"Bob",
"familyName":"Singor",
"honorificSuffixes":null,
"note":null,
"color":"AB47BC",
"color-default":"0098A7",
"givenNamePublic":true,
"familyNamePublic":true,
"additionalNamesPublic":false,
"honorificPrefixesPublic":false,
"honorificSuffixesPublic":false,
"bdayPublic":false,
"imagePublic":true,
"imageBackgroundPublic":true,
"notePublic":true,
"viewCount":399,
"tags":[
],
"_embedded":{
"email":[
{
"id":1206,
"type":"main",
"address":"bob@singor.nl",
"public":true,
"_links":{
"self":{
"href":"http://api.staging.elephone.com/api/contactinformation/email/1206"
}
}
}
],
"organization":[
{
"id":51,
"title":"CEO",
"organizationName":null,
"public":true,
"approvedAt":null,
"_embedded":{
"organization":{
"id":6,
"name":"AdminPolski B.V.",
"description":null,
"registryCountry":"NL",
"registryNumber":"621915350000",
"color":null,
"color-default":"0098A7",
"size":null,
"sizeMin":null,
"sizeMax":null,
"isActive":true,
"isClaimed":false,
"foundedAt":null,
"viewCount":1419
}
}
}
]
}
}
}
{
"_index":"cards",
"_type":"card",
"_id":"1",
"matched":false,
"explanation":{
"value":0.0,
"description":"failure to match filter: cache(_embedded.organization._embedded.organization.registryCountry:NL)",
"details":[
{
"value":0.03876377,
"description":"product of:",
"details":[
{
"value":0.42640144,
"description":"sum of:",
"details":[
{
"value":0.42640144,
"description":"sum of:",
"details":[
{
"value":0.21320072,
"description":"max of:",
"details":[
{
"value":0.21320072,
"description":"weight(givenName:bob in 0) [PerFieldSimilarity], result of:",
"details":[
{
"value":0.21320072,
"description":"score(doc=0,freq=1.0), product of:",
"details":[
{
"value":0.21320072,
"description":"queryWeight, product of:",
"details":[
{
"value":1.0,
"description":"idf(docFreq=0, maxDocs=1)"
},
{
"value":0.21320072,
"description":"queryNorm"
}
]
},
{
"value":1.0,
"description":"fieldWeight in 0, product of:",
"details":[
{
"value":1.0,
"description":"tf(freq=1.0), with freq of:",
"details":[
{
"value":1.0,
"description":"termFreq=1.0"
}
]
},
{
"value":1.0,
"description":"idf(docFreq=0, maxDocs=1)"
},
{
"value":1.0,
"description":"fieldNorm(doc=0)"
}
]
}
]
}
]
}
]
},
{
"value":0.21320072,
"description":"max of:",
"details":[
{
"value":0.21320072,
"description":"weight(familyName:singor in 0) [PerFieldSimilarity], result of:",
"details":[
{
"value":0.21320072,
"description":"score(doc=0,freq=1.0), product of:",
"details":[
{
"value":0.21320072,
"description":"queryWeight, product of:",
"details":[
{
"value":1.0,
"description":"idf(docFreq=0, maxDocs=1)"
},
{
"value":0.21320072,
"description":"queryNorm"
}
]
},
{
"value":1.0,
"description":"fieldWeight in 0, product of:",
"details":[
{
"value":1.0,
"description":"tf(freq=1.0), with freq of:",
"details":[
{
"value":1.0,
"description":"termFreq=1.0"
}
]
},
{
"value":1.0,
"description":"idf(docFreq=0, maxDocs=1)"
},
{
"value":1.0,
"description":"fieldNorm(doc=0)"
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"value":0.09090909,
"description":"coord(1/11)"
}
]
}
]
}
}
{
"cards":{
"mappings":{
"card":{
"properties":{
"_embedded":{
"properties":{
"email":{
"properties":{
"_links":{
"properties":{
"self":{
"properties":{
"href":{
"type":"string"
}
}
}
}
},
"address":{
"type":"string"
},
"id":{
"type":"long"
},
"public":{
"type":"boolean"
},
"type":{
"type":"string"
}
}
},
"organization":{
"properties":{
"_embedded":{
"properties":{
"organization":{
"properties":{
"color-default":{
"type":"string"
},
"id":{
"type":"long"
},
"isActive":{
"type":"boolean"
},
"isClaimed":{
"type":"boolean"
},
"name":{
"type":"string"
},
"registryCountry":{
"type":"string"
},
"registryNumber":{
"type":"string"
},
"viewCount":{
"type":"long"
}
}
}
}
},
"id":{
"type":"long"
},
"public":{
"type":"boolean"
},
"title":{
"type":"string"
}
}
}
}
},
"additionalNames":{
"type":"string"
},
"additionalNamesPublic":{
"type":"boolean"
},
"bdayPublic":{
"type":"boolean"
},
"color":{
"type":"string"
},
"color-default":{
"type":"string"
},
"elephoneName":{
"type":"string"
},
"familyName":{
"type":"string"
},
"familyNamePublic":{
"type":"boolean"
},
"givenName":{
"type":"string"
},
"givenNamePublic":{
"type":"boolean"
},
"honorificPrefixes":{
"type":"string"
},
"honorificPrefixesPublic":{
"type":"boolean"
},
"honorificSuffixes":{
"type":"string"
},
"honorificSuffixesPublic":{
"type":"boolean"
},
"id":{
"type":"integer"
},
"imageBackgroundPublic":{
"type":"boolean"
},
"imagePublic":{
"type":"boolean"
},
"note":{
"type":"string"
},
"notePublic":{
"type":"boolean"
},
"org":{
"type":"string"
},
"role":{
"type":"string"
},
"title":{
"type":"string"
},
"viewCount":{
"type":"long"
}
}
}
}
}
}
curl -XGET 'localhost:9200/cards/card/1/_explain' -d '{
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "bob-singor",
"type": "cross_fields",
"operator": "and",
"fields": [
"givenName",
"familyName",
"title",
"org",
"note",
"name",
"description",
"_embedded.number._embedded.number.number",
"_embedded.address.streetAddress",
"_embedded.address.locality",
"_embedded.address.region",
"_embedded.address.postalCode",
"_embedded.address.countryCode",
"_embedded.organization.title",
"_embedded.organization._embedded.organization.name",
"labels.*",
"labels.nl-NL",
"labels.en-US",
"number"
]
}
},
"filter": {
"term": {
"registryCountry": "NL"
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment