Skip to content

Instantly share code, notes, and snippets.

@psihius
Last active July 18, 2017 14:55
Show Gist options
  • Save psihius/c769c7e2bb39924dd88a0dc0f683824a to your computer and use it in GitHub Desktop.
Save psihius/c769c7e2bb39924dd88a0dc0f683824a to your computer and use it in GitHub Desktop.
{
"sylius" : {
"mappings" : {
"product" : {
"_meta" : {
"model" : "AppBundle\\Entity\\Product"
},
"dynamic_date_formats" : [ ],
"properties" : {
"attributes" : {
"type" : "nested",
"properties" : {
"attribute" : {
"properties" : {
"code" : {
"type" : "keyword",
"normalizer" : "sylius_code_normalizer"
}
}
},
"locale_code" : {
"type" : "keyword",
"normalizer" : "sylius_code_normalizer"
},
"value" : {
"type" : "keyword",
"normalizer" : "sylius_code_normalizer"
}
}
},
"channels" : {
"type" : "nested",
"properties" : {
"code" : {
"type" : "text",
"analyzer" : "sylius_code_analyzer"
}
}
},
"code" : {
"type" : "text",
"analyzer" : "sylius_code_analyzer"
},
"description" : {
"type" : "text"
},
"enabled" : {
"type" : "boolean"
},
"id" : {
"type" : "integer"
},
"images" : {
"type" : "nested",
"properties" : {
"path" : {
"type" : "text"
},
"type" : {
"type" : "text"
}
}
},
"isSimple" : {
"type" : "boolean"
},
"mainTaxon" : {
"properties" : {
"code" : {
"type" : "keyword",
"normalizer" : "sylius_code_normalizer"
},
"name" : {
"type" : "text"
},
"slug" : {
"type" : "text"
}
}
},
"name" : {
"type" : "text"
},
"productTaxons" : {
"type" : "nested",
"properties" : {
"position" : {
"type" : "integer"
},
"taxon" : {
"properties" : {
"code" : {
"type" : "keyword",
"normalizer" : "sylius_code_normalizer"
},
"name" : {
"type" : "text"
}
}
}
}
},
"raw_createdAt" : {
"type" : "date"
},
"raw_name" : {
"type" : "keyword"
},
"shortDescription" : {
"type" : "text"
},
"slug" : {
"type" : "text"
},
"translations" : {
"type" : "nested",
"properties" : {
"locale" : {
"type" : "text"
},
"metaDescription" : {
"type" : "text"
},
"metaKeywords" : {
"type" : "text"
},
"name" : {
"type" : "text"
}
}
},
"variants" : {
"type" : "nested",
"properties" : {
"channelPricings" : {
"type" : "nested",
"properties" : {
"channelCode" : {
"type" : "text"
},
"price" : {
"type" : "integer"
}
}
},
"code" : {
"type" : "keyword",
"normalizer" : "sylius_code_normalizer"
},
"name" : {
"type" : "text"
},
"onHand" : {
"type" : "integer"
},
"onHold" : {
"type" : "integer"
},
"optionValues" : {
"type" : "nested",
"properties" : {
"code" : {
"type" : "keyword",
"normalizer" : "sylius_code_normalizer"
},
"name" : {
"type" : "text"
},
"value" : {
"type" : "text"
}
}
}
}
}
}
}
}
}
}
{
"post_filter": {
"bool": {
"must": [
{
"nested": {
"path": "variants",
"query": {
"nested": {
"path": "variants.channelPricings",
"query": {
"range": {
"variants.channelPricings.price": {
"gte": 0,
"lte": 208700
}
}
}
}
}
}
},
{
"nested": {
"path": "variants",
"query": {
"bool": {
"must": [
{
"nested": {
"path": "variants.optionValues",
"query": {
"terms": {
"variants.optionValues.code": [
"19",
"20",
"21",
"38"
]
}
}
}
},
{
"range": {
"variants.onHand": {
"gt": 0
}
}
}
]
}
}
}
},
{
"term": {
"enabled": true
}
},
{
"nested": {
"path": "variants",
"query": {
"script": {
"script": {
"inline": "doc['variants.onHand'].value - doc['variants.onHold'].value > 0"
}
}
}
}
},
{
"nested": {
"path": "productTaxons",
"query": {
"term": {
"productTaxons.taxon.code": "shoes"
}
}
}
},
{
"nested": {
"path": "channels",
"query": {
"term": {
"channels.code": "default"
}
}
}
}
],
"should": [
{
"term": {
"mainTaxon.code": "shoes"
}
}
]
}
},
"sort": [
{
"raw_createdAt": {
"order": "desc"
}
}
],
"from": 0,
"size": 18,
"query": {
"match_all": {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment