Skip to content

Instantly share code, notes, and snippets.

@schmichael
Last active August 29, 2015 14:01
Show Gist options
  • Save schmichael/e96a4ec4febe00aa2873 to your computer and use it in GitHub Desktop.
Save schmichael/e96a4ec4febe00aa2873 to your computer and use it in GitHub Desktop.
curl -XPUT "http://localhost:9200/testindex"
curl -XPUT "http://localhost:9200/testindex/t/_mapping" -d'
{
"t": {
"properties": {
"some_nested_field": {
"type": "nested",
"properties": {
"k": {"type": "string"},
"v":{"type":"string"}
}
}
}
}
}'
curl -XPUT "http://localhost:9200/testindex/t/abc123" -d'
{
"normal_field": "foo",
"some_nested_field": [
{
"k": "a",
"v": "1"
},
{
"k": "b",
"v": "2"
}
]
}'
# Doesn't return abc123
curl -XGET "http://localhost:9200/testindex/t/_search" -d'
{
"filter": {
"exists": {
"field": "some_nested_field"
}
}
}'
# Works as expected
curl -XGET "http://localhost:9200/testindex/t/_search" -d'
{
"filter": {
"exists": {
"field": "normal_field"
}
}
}'
---------------------
PUT /testindex
PUT /testindex/t/_mapping
{
"t": {
"properties": {
"some_nested_field": {
"type": "nested",
"properties": {
"k": {"type": "string"},
"v":{"type":"string"}
}
}
}
}
}
PUT /testindex/t/abc123
{
"normal_field": "foo",
"some_nested_field": [
{
"k": "a",
"v": "1"
},
{
"k": "b",
"v": "2"
}
]
}
GET /testindex/t/_search
{
"filter": {
"exists": {
"field": "some_nested_field"
}
}
}
GET /testindex/t/_search
{
"filter": {
"exists": {
"field": "normal_field"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment