Skip to content

Instantly share code, notes, and snippets.

View cedufca's full-sized avatar

Carlos Eduardo da Fonseca cedufca

  • Joinville / Santa Catarina / Brazil
View GitHub Profile
@cedufca
cedufca / gist:1279224
Created October 11, 2011 19:59
ElasticSearch 11/10/11 - Mappings and Settings
mappings:
event:
index_analyzer: standardAnalyzer
search_analyzer: standardAnalyzer
properties:
name:
type: multi_field
fields:
name: { type: string, index: analyzed }
partial: { type: string, index: analyzed, index_analyzer: ngramAnalyzer, search_analyzer: standardAnalyzer }
@cedufca
cedufca / gist:1279209
Created October 11, 2011 19:55
ElasticSearch 11/10/11 - Results
---
-
attributes:
:name: Ruby on Rails 2011
:description: ""
:programs: ""
:address: Arroio Grande Santa Catarina Brasil
:date_time_end: 2011-10-19 13:46:00
:id: "395"
:_score: 0.0130888205
@cedufca
cedufca / gist:1279199
Created October 11, 2011 19:52
ElasticSearch 11/10/11 - Query
---
:query:
:filtered:
:query:
:bool:
:should:
- :text:
:name:
:query: euax arroio grande
:boost: 10.0
//algo +/- assim
var eventos = $(".barra_lateral li.eu_vou").map(function() {
return {date: new Date($(this).attr("data_inicio")), element: li}
}).get()
eventos.sort(function(a, b){ return a.date < b.date })
$(".barra_lateral li.eu_vou").html($.map(eventos, function(e) { return e.element }))
@cedufca
cedufca / gist:1265607
Created October 5, 2011 20:30
ElasticSearch Negative Boosting
---
:query:
:boosting:
:positive:
:filtered:
:query:
:bool:
:should:
- :text:
:name:
@cedufca
cedufca / gist:1259248
Created October 3, 2011 14:45
ElasticSearch ngrams
# My settings
mappings:
event:
index_analyzer: standardAnalyzer
search_analyzer: standardAnalyzer
properties:
name:
type: multi_field
fields:
@cedufca
cedufca / gist:1253912
Created September 30, 2011 14:31
ElasticSearch wildcard score
### Query without wildcard
query:
bool:
should:
- field:
name:
query: linguagem
boost: 10.0
- field:
description:
query:
bool:
should:
- field:
name: ruby
boost: 10.0
- field:
description: ruby
boost: 5.0
- field: