Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:eb0f09a58668af4b726f
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
curl -XPUT localhost:9200/products-test -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"product": {
"properties": {
"id": { "type": "integer", "store": true },
"name": { "type": "string", "store": "yes" },
"kind": { "type": "string", "store": "no" },
"tags": {
"type": "nested",
"properties": {
"slug": { "type": "string" },
"label": { "type": "string" }
}
}
}
}
}
}'
 
curl -XPOST "localhost:9200/products-test/product?refresh" -d '{
"id": "112",
"tags": [
{"slug": "black"}
]
}'
 
curl -XPOST "localhost:9200/products-test/product?refresh" -d '{
"id": "113",
"tags": [
{"slug": "red"}
]
}'
echo
curl "localhost:9200/products-test/product/_search?fields=id&pretty" -d '{
"query": {
"nested": {
"path": "tags",
"filter": {
"bool": {
"must": {
"terms": {
"tags.slug": [ "discount", "black"]
}
}
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.