Skip to content

Instantly share code, notes, and snippets.

@dorsev
Last active December 24, 2019 23:11
Show Gist options
  • Save dorsev/6b6316bcc34d6806c2c3ceb42ca79614 to your computer and use it in GitHub Desktop.
Save dorsev/6b6316bcc34d6806c2c3ceb42ca79614 to your computer and use it in GitHub Desktop.
query on dynamic template field
curl -X GET "localhost:9200/_search?pretty" -H 'Content-Type: application/json' -d'
{
"query": {
"match" : {
"actions.tags.name" : {
"query" : "John"
}
}
}
}
'
# returns 1 match(doc 1)
curl -X GET "localhost:9200/_search?pretty" -H 'Content-Type: application/json' -d'
{
"query": {
"match" : {
"actions.tags.lname" : {
"query" : "John"
}
}
}
}
'
# returns zero matches
# search by value
curl -X GET "localhost:9200/_search?pretty" -H 'Content-Type: application/json' -d'
{
"query": {
"query_string" : {
"fields": ["actions.tags.*" ],
"query" : "Dor"
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment