Skip to content

Instantly share code, notes, and snippets.

@jbartek
Created October 15, 2012 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbartek/3895691 to your computer and use it in GitHub Desktop.
Save jbartek/3895691 to your computer and use it in GitHub Desktop.
elastic-help
INDEXES:
{"Accounts":{"properties":{"name":{"boost":3,"type":"string"},"phone_fax":{"boost":1,"type":"string"},"phone_office":{"boost":1,"type":"string"},"phone_alternate":{"boost":1,"type":"string"},"email1":{"boost":3,"index":"not_analyzed","type":"string"},"doc_owner":{"boost":1,"type":"string","index":"not_analyzed"},"user_favorites":{"boost":1,"type":"array","index":"not_analyzed"}}}}
{"Calls":{"properties":{"name":{"boost":"1","type":"string"},"description":{"boost":"3","type":"string"},"doc_owner":{"boost":1,"type":"string","index":"not_analyzed"},"user_favorites":{"boost":1,"type":"array","index":"not_analyzed"}}}}
{"Cases":{"properties":{"name":{"boost":3,"type":"string"},"case_number":{"boost":3,"type":"string"},"doc_owner":{"boost":1,"type":"string","index":"not_analyzed"},"user_favorites":{"boost":1,"type":"array","index":"not_analyzed"}}}}
RECORDS:
{
_index: 5b04e75a7a93007a0bbdbb4a4764804f
_type: Calls
_id: 1374c90d-1ee3-922a-ac78-507c28cd6aa5
_version: 1
_score: 1
_source: {
name: 5678
description: 1234
module: Calls
team_set_id: 1
user_favorites: [ ]
doc_owner: 1
}
}
{
_index: 5b04e75a7a93007a0bbdbb4a4764804f
_type: Calls
_id: 36f531d3-82aa-c2a9-0b6a-507c2895b893
_version: 1
_score: 1
_source: {
name: 1000
description: 5678
module: Calls
team_set_id: 1
user_favorites: [ ]
doc_owner: 1
}
}
QUERY:
{
"query": {
"query_string": {
"query": "5678",
"analyze_wildcard": true,
"auto_generate_phrase_queries": false,
"rewrite": "top_terms_10",
"fields": [
"_all"
]
}
},
"from": 0,
"facets": {
"_type": {
"terms": {
"field": "_type"
}
}
},
"size": 10
}
RESULT:
{
took: 2
timed_out: false
_shards: {
total: 1
successful: 1
failed: 0
}
hits: {
total: 2
max_score: 2.999094
hits: [
{
_index: 5b04e75a7a93007a0bbdbb4a4764804f
_type: Calls
_id: 1374c90d-1ee3-922a-ac78-507c28cd6aa5
_score: 2.999094
_source: {
name: 5678
description: 1234
module: Calls
team_set_id: 1
user_favorites: [ ]
doc_owner: 1
}
}
{
_index: 5b04e75a7a93007a0bbdbb4a4764804f
_type: Calls
_id: 36f531d3-82aa-c2a9-0b6a-507c2895b893
_score: 2.999094
_source: {
name: 1000
description: 5678
module: Calls
team_set_id: 1
user_favorites: [ ]
doc_owner: 1
}
}
]
}
facets: {
_type: {
_type: terms
missing: 0
total: 2
other: 0
terms: [
{
term: Calls
count: 2
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment