Hi
I've created the following Index and mapping :
Index : curl -XPUT 'http://10.118.192.165:9200/matches'
Mapping:
curl -XPUT 'http://10.118.192.165:9200/matches/tags_nested/_mapping' -d '
{
"tags_nested":{
"properties":{
"name": {
"type": "string"
},
"total_runs": {
"type": "integer"
},
"matches_played": {
"type": "string"
},
"highest_score": {
"type": "string"
},
"tags": {
"type" : "nested"
}
}
}
}'
the data inserted is :
curl XPUT 'http://10.118.192.165:9200/matches/tags_nested/1' -d'
{
"name" : "sachin",
"total_runs" : "500",
"matches_played" : "4",
"highest_score" : "200*",
"tags" :[
{
"user" : "kuwar",
"tag" : "master blaster"
},
{
"user" : "nipun",
"tag" : "world class"
},
{
"user" : "mayank",
"tag" : "200 not out"
}
]
}'
curl XPUT 'http://10.118.192.165:9200/matches/tags_nested/2' -d'
{
"name" : "hayden",
"total_runs" : "300",
"matches_played" : "4",
"highest_score" : "110",
"tags" :[
{
"user" : "kuwar",
"tag" : "good knock"
},
{
"user" : "nipun",
"tag" : "match winning"
}
]
}'
I want to find the record where the user "kuwar" has a tag "master blaster"
. Have designed the following query but it does not give me the result.
curl -XGET
'http://10.118.192.165:9200/matches/tags_nested/_search?pretty=true' -d '
{
"query": {
"nested": {
"path": "tags",
"query":{
"filtered": {
"query": { "match_all": {}},
"filter": {
"and": [
{"term": {"tags.user": "kuwar"}},
{"term": {"tags.tag": "master blaster"}}
]
}
}
}
}
}
}'
the query does not give me the result. however if i change tags.tag to
"master" instead of "master blaster" the output comes.
how to solve this problem ?
thanks in advance.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.