Skip to content

Instantly share code, notes, and snippets.

@ballbrk
Last active December 15, 2015 10:29
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 ballbrk/5246152 to your computer and use it in GitHub Desktop.
Save ballbrk/5246152 to your computer and use it in GitHub Desktop.
Problem with ElasticSearch 0.90 RC1
#!/bin/bash
curl -XPOST localhost:9200/geniuzz -d '
{
"settings":{
"index":{
"number_of_shards":10,
"number_of_replicas":2,
"analysis":{
"analyzer":{
"email":{
"type":"custom",
"tokenizer":"uax_url_email"
},
"spanish":{
"type":"custom",
"tokenizer":"standard",
"filter":[
"lowercase",
"stop_es",
"es_stemmer",
"asciifolding"
]
}
},
"filter":{
"stop_es":{
"type":"stop",
"ignore_case":"true",
"stopwords" : ["_english_", "_spanish_"],
"stopwords_path":"/opt/elasticsearch_cluster/node1/config/stopwords/es/stop_es.txt"
},
"es_stemmer":{
"type":"stemmer",
"name":"light_spanish"
}
}
}
}
}
}
'
#!/bin/bash
curl -XPUT 'http://localhost:9200/geniuzz/products/_mapping' -d '{
"products": {
"properties":{
"username_pro" : {
"type" : "string",
"boost": 2.0,
"store" : "yes",
"index" : "not_analyzed",
"include_in_all" : true
},
"id_user" : {
"type" : "long",
"boost": 2.0,
"store" : "yes",
"index" : "analyzed",
"include_in_all" : false
},
"id_user_level" : {
"type" : "integer",
"boost": 2.0,
"store" : "yes",
"index" : "analyzed",
"include_in_all" : false
},
"user_deleted" : {
"type" : "integer",
"boost": 2.0,
"store" : "yes",
"include_in_all" : false
},
"verified_account" : {
"type" : "boolean",
"boost": 2.0,
"store" : "yes",
"include_in_all" : false
},
"iso2_cou":{
"type" : "string",
"store" : "yes",
"index" : "not_analyzed",
"include_in_all" : false
},
"name_cou":{
"type" : "string",
"store" : "yes",
"analyzer":"spanish",
"index" : "analyzed",
"include_in_all" : false
},
"name_sub":{
"type" : "string",
"store" : "yes",
"analyzer":"spanish",
"index" : "analyzed",
"include_in_all" : true
},
"slug_sub":{"type" : "string", "index" : "not_analyzed"},
"name_cat":{
"type" : "string",
"store" : "yes",
"analyzer":"spanish",
"index" : "analyzed",
"include_in_all" : true
},
"slug_cat":{"type" : "string", "index" : "not_analyzed"},
"name_level":{
"type" : "string",
"store" : "yes",
"index" : "not_analyzed",
"include_in_all" : false
},
"id_gigs" : {
"type" : "long",
"boost": 2.0,
"store" : "yes",
"index" : "analyzed",
"include_in_all" : false
},
"title_gig" : {
"type" : "string",
"boost": 2.0,
"store" : "yes",
"analyzer":"spanish",
"index" : "analyzed",
"include_in_all" : true
},
"description_gig" : {
"type" : "string",
"boost": 2.0,
"store" : "yes",
"analyzer":"spanish",
"index" : "analyzed",
"include_in_all" : true
},
"slug_gig": {
"type" : "string",
"store" : "yes",
"index" : "not_analyzed",
"include_in_all" : false
},
"positive_feedback_count_gig" : {
"type" : "long",
"store" : "yes",
"null_value": 0,
"include_in_all":false,
"index":"no"
},
"negative_feedback_count_gig" : {
"type" : "long",
"store" : "yes",
"null_value": 0,
"include_in_all":false,
"index":"no"
},
"videos_count" : {
"type":"long",
"store":"yes",
"null_value": 0
},
"rating_gig" : {
"type" : "long",
"store" : "yes",
"null_value": 0,
"include_in_all":false
},
"favoritecount_gig" : {
"type" : "long",
"store" : "yes",
"null_value": 0,
"include_in_all":false
},
"amount_gig" : {
"type" : "float",
"store" : "yes",
"null_value": 0,
"include_in_all":false
},
"is_active" : {
"type":"integer",
"store":"yes",
"null_value":1
},
"is_deleted" : {
"type":"integer",
"store":"yes",
"null_value":0
},
"featured_level_gig" : {
"type":"integer",
"store":"yes",
"index" : "analyzed",
"null_value":0
},
"is_paused" : {
"type":"integer",
"store":"yes",
"null_value":0
},
"is_admin_suspend" : {
"type":"integer",
"store":"yes",
"null_value":0
},
"imagedir_pro": {
"type" : "string",
"include_in_all" : false,
"store":"yes",
"index" : "not_analyzed"
},
"filename_pro": {
"type" : "string",
"include_in_all" : false,
"store":"yes",
"index" : "not_analyzed"
},
"images" : {
"dynamic" : "true",
"properties" : {
"dir_ima" : {
"type" : "string",
"store":"yes",
"index" : "not_analyzed",
"include_in_all" : false
},
"filename_ima" : {
"type" : "string",
"store":"yes",
"index" : "not_analyzed",
"include_in_all" : false
} ,
"id_imagen" : {
"type" : "long",
"store":"yes",
"include_in_all" : false
}
}
},
"tags" : {
"dynamic" : "true",
"properties" : {
"id_tags" : {
"type" : "long",
"include_in_all" : false
},
"name_tag" : {
"type" : "string",
"store" : "yes",
"analyzer":"spanish",
"index" : "analyzed"
},
"slug_tag" : {
"type" : "string",
"include_in_all" : false,
"store":"yes",
"index" : "not_analyzed"
}
}
},
"videos" : {
"dynamic" : "true",
"properties" : {
"id_videos" : {
"type" : "long",
"include_in_all" : false
},
"url_vid" : {
"type" : "string",
"store" : "yes",
"analyzer":"spanish",
"index" : "analyzed"
},
"is_active_vid" : {
"type":"integer",
"store":"yes",
"index" : "analyzed",
"null_value":0
}
}
}
}
}
}
'
{
_index: "geniuzz",
_type: "product",
_id: "10908",
_version: 1,
exists: true,
_source: {
id_gigs: 10908,
username_pro: "carlitosvillas",
id_user: 9350,
id_user_level: 4,
verified_account: 1,
iso2_cou: "VE",
name_cou: "Venezuela",
name_sub: "Fans en facebook",
name_level: "diamante",
slug_sub: "facebook-fans-en-facebook",
videos_count: 0,
name_cat: "Facebook",
slug_cat: "facebook",
featured_level_gig: 0,
title_gig: "Te Diseño un Grandioso Timeline para FACEBOOK",
user_deleted: 0,
description_gig: "NO TE DEJES ENGAÑAR! TRABAJOS TOTALMENTE ORIGINALES Y SIN MUESTRAS DE OTRAS PERSONAS!. Te diseño grandiosos Timeline para Facebook!, que esperas? atrae nuevos contactos, fans, suscriptores a tu cuenta!. -------- El cliente deberá aportar toda la información de lo que quiera para su timeline. ¿Mas info? Ve mis otros post: http://www.myntmarket.com/user/carlitosvillas ¿Por qué trabajar conmigo? - Top ventas - 100% calificaciones positivas - Clientes satisfechos! ",
slug_gig: "te-diseno-un-grandioso-timeline-para-facebook-10908",
positive_feedback_count_gig: 33,
negative_feedback_count_gig: 0,
rating_gig: 33,
favoritecount_gig: 8,
amount_gig: 10,
is_active: 1,
is_deleted: 0,
is_paused: 0,
is_admin_suspend: 0,
created_gig: "2012-06-15 21:48:19",
modified_gig: "2013-03-13 16:03:15",
imagedir_pro: "UserAvatar/9350",
filename_pro: "twitter-pic.jpg",
images: [
{
id_imagen: 28724,
filename_ima: "aviso-mynt-face.jpg",
dir_ima: "Gig/10908"
}
],
tags: [
{
id_tags: 94,
name_tag: "facebook",
slug_tag: "facebook"
},
{
id_tags: 2396,
name_tag: "portada",
slug_tag: "portada"
},
{
id_tags: 10202,
name_tag: "Timeline",
slug_tag: "timeline"
},
{
id_tags: 18080,
name_tag: "timeline",
slug_tag: "timeline"
}
],
videos: [ ]
}
}
curl -XGET 'http://localhost:9200/geniuzz/product/_search?pretty=true' -d '
{
"from":0,
"size":1,
"sort":{"id_gigs":"desc"},
"query":{"bool":{
"must":[
{"term":{"is_active":1}},
{"term":{"is_deleted":0}},
{"term":{"user_deleted":0}},
{"term":{"is_admin_suspend":0}},
{"term":{"slug_sub":"facebook-fans-en-facebook"}},
{"term":{"slug_cat":"facebook"}}
]}}}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment