Skip to content

Instantly share code, notes, and snippets.

@damienalexandre
Created December 6, 2013 10:28
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 damienalexandre/7821653 to your computer and use it in GitHub Desktop.
Save damienalexandre/7821653 to your computer and use it in GitHub Desktop.
text: Calendrier de l'Afsy, avec des Bundles indexés.
analyzer:
custom_french_analyzer:
type: custom
tokenizer: letter
filter: ["asciifolding", "lowercase", "french_stem", "stop_fr"]
filter:
stop_fr:
type: "stop"
stopwords: ["l", "m", "t", "qu", "n", "s", "j", "d"]
# These are sample documents.
_index: afsy
_type: Article
id: 2
title: Introduction au composant Config
slug: introduction-au-composant-config
body: <p> <strong>Mercredi 9 mai 2012</strong>, <strong>de 19h à 20h</strong>, la société <a href="http://www.theodo.fr/">Theodo</a> accueille <strong>Christophe Coevet</strong> (<a href="https://twitter.com/#!/Stof70">Stof70</a>) qui présentera une introduction au composant autonome &laquo; Config &raquo; de Symfony. Cette conférence mettra en avant l'utilité de ce composant et sa mise en oeuvre pratique au sein des bundles. Christophe mettra aussi l'accent sur l'utilisation de ce composant en dehors du contexte de Symfony. La soirée se terminera par un pot général au pub <strong>The Lions</strong>. </p>
markdown_body: bla bla in markdown
language: fr
published_at: 2013-11-23T00:00:00+0100
address: Pub The Lions 120 rue Montmartre 75002 Paris
map: <img src="http://maps.google.com/maps/api/staticmap?center=48.867804,2.343843&amp;zoom=16&amp;markers=size:mid|color:green|120+rue+Montmartre,+Paris&amp;path=color:0x0000FFff|weight:10|48.88435,2.40034&amp;size=470x260&amp;sensor=true" alt="" />
city: Paris
is_published: true
---
_index: afsy
_type: Article
id: 1
title: Calendrier de l'avent 2013 par l'Afsy
slug: calendrier-de-l-avent-2013-par-l-afsy
body: <p>Pour les fêtes de cette fin d'année, l'Afsy vous a concocté <strong>un calendrier de l'avent</strong>, avec du PHP dedans.</p><p>Rendez-vous sur <a href="/app_dev.php/avent/2013">cette page</a>
markdown_body: html content loaded, please do not edit this post
language: fr
published_at: 2012-05-09T00:00:00+0200
address:
map: <a href="/avent/2013"><img src="http://www.homelifeweekly.com/wp-content/uploads/noel-christmas-card-printable-design.png" width="333" height="184" /></a>
city: Paris
is_published: true
Article:
properties:
body:
type: string
analyzer: custom_french_analyzer
title:
type: string
analyzer: custom_french_analyzer
#!/bin/bash
export ELASTICSEARCH_ENDPOINT="http://localhost:9200"
# Create indexes
curl -XPUT "$ELASTICSEARCH_ENDPOINT/afsy" -d '{
"settings": {
"analysis": {
"text": "Calendrier de l'Afsy, avec des Bundles indexés.",
"analyzer": {
"custom_french_analyzer": {
"type": "custom",
"tokenizer": "letter",
"filter": [
"asciifolding",
"lowercase",
"french_stem",
"stop_fr"
]
}
},
"filter": {
"stop_fr": {
"type": "stop",
"stopwords": [
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d"
]
}
}
}
},
"mappings": {
"Article": {
"properties": {
"body": {
"type": "string",
"analyzer": "custom_french_analyzer"
},
"title": {
"type": "string",
"analyzer": "custom_french_analyzer"
}
}
}
}
}'
# Index documents
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_bulk?refresh=true" -d '
{"index":{"_index":"afsy","_type":"Article"}}
{"id":2,"title":"Introduction au composant Config","slug":"introduction-au-composant-config","body":"<p> <strong>Mercredi 9 mai 2012</strong>, <strong>de 19h à 20h</strong>, la société <a href=\"http://www.theodo.fr/\">Theodo</a> accueille <strong>Christophe Coevet</strong> (<a href=\"https://twitter.com/#!/Stof70\">Stof70</a>) qui présentera une introduction au composant autonome &laquo; Config &raquo; de Symfony. Cette conférence mettra en avant l'utilité de ce composant et sa mise en oeuvre pratique au sein des bundles. Christophe mettra aussi l'accent sur l'utilisation de ce composant en dehors du contexte de Symfony. La soirée se terminera par un pot général au pub <strong>The Lions</strong>. </p>","markdown_body":"bla bla in markdown","language":"fr","published_at":"2013-11-23T00:00:00+0100","address":"Pub The Lions 120 rue Montmartre 75002 Paris","map":"<img src=\"http://maps.google.com/maps/api/staticmap?center=48.867804,2.343843&amp;zoom=16&amp;markers=size:mid|color:green|120+rue+Montmartre,+Paris&amp;path=color:0x0000FFff|weight:10|48.88435,2.40034&amp;size=470x260&amp;sensor=true\" alt=\"\" />","city":"Paris","is_published":true}
{"index":{"_index":"afsy","_type":"Article"}}
{"id":1,"title":"Calendrier de l'avent 2013 par l'Afsy","slug":"calendrier-de-l-avent-2013-par-l-afsy","body":"<p>Pour les fêtes de cette fin d'année, l'Afsy vous a concocté <strong>un calendrier de l'avent</strong>, avec du PHP dedans.</p><p>Rendez-vous sur <a href=\"/app_dev.php/avent/2013\">cette page</a>","markdown_body":"html content loaded, please do not edit this post","language":"fr","published_at":"2012-05-09T00:00:00+0200","address":null,"map":"<a href=\"/avent/2013\"><img src=\"http://www.homelifeweekly.com/wp-content/uploads/noel-christmas-card-printable-design.png\" width=\"333\" height=\"184\" /></a>","city":"Paris","is_published":true}
'
# Do searches
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_search?pretty" -d '
{
"query": {
"match": {
"body": {
"query": "Bundles"
}
}
}
}
'
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_search?pretty" -d '
{
"query": {
"match": {
"body": {
"query": "Bundle"
}
}
}
}
'
curl -XPOST "$ELASTICSEARCH_ENDPOINT/_search?pretty" -d '
{
"query": {
"match_all": {}
},
"facets": {
"years": {
"date_histogram": {
"field": "published_at",
"interval": "year"
}
}
}
}
'
# Auto generated by Found's Play-tool at 2013-12-06T14:53:41+01:00
version: 0
title: Afsy Advent calendar playground
description: ""
query:
match:
body:
query: "Bundles"
---
query:
match:
body:
query: "Bundle"
---
query:
match_all: {}
facets:
years:
date_histogram:
field: published_at
interval: year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment