Skip to content

Instantly share code, notes, and snippets.

@yanglikun
Last active June 28, 2017 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanglikun/81428d2be22211b69c8b85cefb3aeaec to your computer and use it in GitHub Desktop.
Save yanglikun/81428d2be22211b69c8b85cefb3aeaec to your computer and use it in GitHub Desktop.
es-关联关系-object
DELETE relation_object_index
PUT /relation_object_index/relation_object_type/1
{
"projectName": "train",
"members": [
{
"firstName":"san",
"lastName":"zhang"
},{
"firstName":"si",
"lastName":"li"
}
]
}
PUT /relation_object_index/relation_object_type/2
{
"projectName": "airplane",
"members": [
{
"firstName":"wu",
"lastName":"wang"
},{
"firstName":"liu",
"lastName":"zhao"
}
]
}
GET /relation_object_index/_mapping
GET /relation_object_index/_search
#because store as flat
GET /relation_object_index/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"members.lastName": {
"value": "zhang"
}
}
},
{
"term": {
"members.firstName": {
"value": "si"
}
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment