Skip to content

@imotov /gist:eb0f09a58668af4b726f secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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.