Skip to content

Instantly share code, notes, and snippets.

@stephlag
stephlag / geolocated_min_price.json
Created June 18, 2014 17:03
Geolocated offers sorted by geolocated min price
# Offers at less than 5 kms from Bordeaux
GET /products/_search
{
"query": {
"filtered": {
"filter": {
"nested": {
"path": "offers_store",
"filter": {
"geo_distance": {
@stephlag
stephlag / post_filter.json
Created June 13, 2014 16:23
UC18 - Exclude filter on faceting field
GET /products/_search
{
"query": {
"multi_match": {
"query": "armoire",
"type": "most_fields",
"fields": [
"title^5",
"brand_name^5",
"category_name_path^4",
@stephlag
stephlag / suggest.json
Created June 12, 2014 16:49
Suggest example
GET /products/_search
{
"suggest": {
"text": "hocket",
"my-suggest-1": {
"term": {
"field": "title"
}
},
"my-suggest-2": {
@stephlag
stephlag / brand_relevance_order.json
Created June 12, 2014 16:23
Brand names ordered by relevance (desc)
GET /products/_search
{
"explain": false,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "hochet fille",
"type": "most_fields",
"fields": [
@stephlag
stephlag / Facet_combination.json
Created June 12, 2014 14:08
Brand, category hierarchy and price range facet
GET /products/_search
{
"explain": false,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "hochet",
"type": "best_fields",
"fields": [
@stephlag
stephlag / Price_range_facet.json
Created June 12, 2014 13:31
Price range facet
GET /products/_search
{
"explain": false,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "Hochet Personnalisable Chat",
"type": "best_fields",
"fields": [
{
"products": {
"mappings": {
"product": {
"properties": {
"2": {
"type": "string"
},
"3": {
"type": "string"
@stephlag
stephlag / product_mapping.json
Last active August 29, 2015 14:02
Product mapping
PUT /products/_mapping/product
{
"product": {
"_all": {
"enabled": true
},
"properties": {
"id": {
"type": "string"
},
@stephlag
stephlag / best_offer.json
Created May 27, 2014 15:01
Best price for offers by product
GET /products/_search
{
"size": 0,
"aggs": {
"products": {
"terms": {
"field": "id",
"size": 10
},
"aggs": {
@stephlag
stephlag / hierarchical_facets.json
Last active August 29, 2015 14:01
Hierarchical Facets
# Results by Cat1 & 2
GET /products/_search
{
"query": {
"match_all": {}
},
"filter":{
},
"aggs": {