Skip to content

Instantly share code, notes, and snippets.

@jlpoveda
Created September 25, 2014 21:38
Show Gist options
  • Save jlpoveda/eb3a4dd55a11f8c1a7a8 to your computer and use it in GitHub Desktop.
Save jlpoveda/eb3a4dd55a11f8c1a7a8 to your computer and use it in GitHub Desktop.
Algunas pruebas con Elasticsearch
PUT /ofertix/campanya_producto/3
{
"nombre": "Zapatos 3",
"campanya_id": "3725",
"habilitado": "1",
"categoria": {
"1": "Actual",
"2": "Hombre",
"3": "Calzado",
"4": "Deportivo"
}
}
GET /ofertix/campanya_producto/_search
{
"_source": "categoria.4",
"query": {
"terms": {
"categoria": ["Calzado"],
"minimum_should_match" : 1
}
}
}
GET /ofertix/campanya_producto/_search
{
"_source": "categoria.4",
"query": {
"bool": {
"should": [
{ "match": { "categoria.1": "Actual" }},
{ "match": { "categoria.4": "Elegante" }}
],
"minimum_should_match": 2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment