Skip to content

Commit

Permalink
Added test resources for inner hits
Browse files Browse the repository at this point in the history
  • Loading branch information
davemoore- committed May 7, 2024
1 parent 0538a46 commit 7ce9cb0
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/resources/TestDataInnerHits.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{ "index" : { "_index" : "zentity_test_index_inner_hits", "_id" : "1" }}
{ "name": "Allie Jones", "phone": [{ "number": "mobile", "type": "123-555-1234" }, { "number": "mobile", "type": "123-555-0987" }], "address": [{ "street": "123 Main St", "city": "Washington", "state": "DC", "phone": { "number": "202-555-1234", "type": "home" }}, { "street": "555 Broad St", "city": "New York", "state": "NY", "phone": { "number": "202-555-9876", "type": "work" }}]}
101 changes: 101 additions & 0 deletions src/test/resources/TestEntityModelInnerHits.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"attributes": {
"name": {},
"phone": {},
"address_street": {},
"address_city": {},
"address_state": {}
},
"resolvers": {
"name_phone": {
"attributes": [
"name",
"phone"
]
}
},
"matchers": {
"exact": {
"clause": {
"term": {
"{{ field }}": "{{ value }}"
}
}
},
"exact_nested_phone": {
"clause": {
"nested": {
"path": "phone",
"query": {
"term": {
"{{ field }}": "{{ value }}"
}
},
"inner_hits": {
"name": "{{ clause_name }}"
}
}
}
},
"exact_nested_address": {
"clause": {
"nested": {
"path": "address",
"query": {
"term": {
"{{ field }}": "{{ value }}"
}
},
"inner_hits": {
"name": "{{ clause_name }}"
}
}
}
},
"exact_nested_address_phone": {
"clause": {
"nested": {
"path": "address.phone",
"query": {
"term": {
"{{ field }}": "{{ value }}"
}
},
"inner_hits": {
"name": "{{ clause_name }}"
}
}
}
}
},
"indices": {
"test": {
"fields": {
"name": {
"attribute": "name",
"matcher": "exact"
},
"phone.number": {
"attribute": "phone",
"matcher": "exact_nested_phone"
},
"address.street": {
"attribute": "address_street",
"matcher": "exact_nested_address"
},
"address.city": {
"attribute": "address_city",
"matcher": "exact_nested_address"
},
"address.state": {
"attribute": "address_state",
"matcher": "exact_nested_address"
},
"address.phone.number": {
"attribute": "phone",
"matcher": "exact_nested_address_phone"
}
}
}
}
}
49 changes: 49 additions & 0 deletions src/test/resources/TestIndexInnerHits.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 2
},
"mappings": {
"properties": {
"name": {
"type": "keyword"
},
"phone": {
"type": "nested",
"properties": {
"number": {
"type": "keyword"
},
"type": {
"type": "keyword"
}
}
},
"address": {
"type": "nested",
"properties": {
"street": {
"type": "keyword"
},
"city": {
"type": "keyword"
},
"state": {
"type": "keyword"
},
"phone": {
"type": "nested",
"properties": {
"number": {
"type": "keyword"
},
"type": {
"type": "keyword"
}
}
}
}
}
}
}
}

0 comments on commit 7ce9cb0

Please sign in to comment.