Jira Legacy |
---|
server | System JiraJIRA |
---|
columnIds | issuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution |
---|
columns | key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution |
---|
serverId | 01505d01-b853-3c2e-90f1-ee9b165564fc |
---|
key | MSEARCH-426 |
---|
|
...
Code Block |
---|
|
{
"group" : "fans",
"user.first" : [ "alice", "john" ],
"user.last" : [ "smith", "white" ]
} |
The user.first
and user.last
fields are flattened into multi-value fields and the association between alice
and white
is lost. This document would incorrectly match a query for alice AND smith.
Related documentation: Nested field type | Elasticsearch Guide [8.4] | Elastic
Solution
Using nested fields for arrays of objects.
...
Code Block |
---|
|
{
"query": {
"nested": {
"path": "user",
"query": {
"bool": {
"must": [
{ "match": { "user.first": "Alice" }},
{ "match": { "user.last": "Smith" }}
]
}
}
}
}
} |
Note |
---|
Because nested documents are indexed as separate documents, they can only be accessed within the scope of the nested query |
Info |
---|
All fields in the nested object are also could be added to the parent document as standard (flat) fields by using include_in_parent parameter. |
Testing
Changes in Index mappings | Indexed instances | Amount of documents | Total index size | Avg size per instance | Contributor search | Keyword search |
---|
Current | 8266332 | 8266332 | 25850326050B ~ 25,8GB | 3127 |
Expand |
---|
Code Block |
---|
{
"query": {
"multi_match": {
"query": "Pavlo Smahin",
"fields": [
"contributors.name^1.0"
],
"type": "cross_fields",
"operator": "AND"
}
}
} |
|
|
Expand |
---|
Code Block |
---|
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "semantic",
"fields": [
"alternativeTitles.alternativeTitle.*^1.0",
"contributors.name^1.0",
"identifiers.value^1.0",
"indexTitle.*^1.0",
"series.*^1.0",
"title.*^1.0"
],
"type": "best_fields",
"operator": "OR"
}
},
{
"multi_match": {
"query": "web",
"fields": [
"alternativeTitles.alternativeTitle.*^1.0",
"contributors.name^1.0",
"identifiers.value^1.0",
"indexTitle.*^1.0",
"series.*^1.0",
"title.*^1.0"
],
"type": "best_fields",
"operator": "OR"
}
},
{
"multi_match": {
"query": "primer",
"fields": [
"alternativeTitles.alternativeTitle.*^1.0",
"contributors.name^1.0",
"identifiers.value^1.0",
"indexTitle.*^1.0",
"series.*^1.0",
"title.*^1.0"
],
"type": "best_fields",
"operator": "OR"
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
}
} |
|
|
nested contributors | 8266332 | 22533677 | 26439831643B ~ 26,4GB | 3198 |
Expand |
---|
Code Block |
---|
{
"query": {
"nested": {
"path": "contributors",
"query": {
"match_phrase": {
"contributors.name": "Pavlo Smahin Test"
}
}
}
}
} |
|
|
Expand |
---|
Code Block |
---|
{
"query": {
"bool": {
"should": [
{
"nested": {
"path": "contributors",
"query": {
"match_phrase": {
"contributors.name": "Pavlo Smahin Test"
}
}
}
},
{
"bool": {
"must": [
{
"multi_match": {
"query": "Pavlo",
"fields": [
"alternativeTitles.alternativeTitle.*^1.0",
"identifiers.value^1.0",
"indexTitle.*^1.0",
"series.*^1.0",
"title.*^1.0"
],
"type": "best_fields",
"operator": "OR"
}
},
{
"multi_match": {
"query": "Smahin",
"fields": [
"alternativeTitles.alternativeTitle.*^1.0",
"identifiers.value^1.0",
"indexTitle.*^1.0",
"series.*^1.0",
"title.*^1.0"
],
"type": "best_fields",
"operator": "OR"
}
},
{
"multi_match": {
"query": "Test",
"fields": [
"alternativeTitles.alternativeTitle.*^1.0",
"identifiers.value^1.0",
"indexTitle.*^1.0",
"series.*^1.0",
"title.*^1.0"
],
"type": "best_fields",
"operator": "OR"
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
}
]
}
}
} |
|
|
nested contributors with include_in_parent | 8266332 | 22533677 | 27184318612B ~ 27,1GB | 3288 |
Expand |
---|
Code Block |
---|
{
"query": {
"multi_match": {
"query": "Pavlo Smahin",
"fields": [
"contributors.name^1.0"
],
"type": "cross_fields",
"operator": "AND"
}
}
} |
|
|
Expand |
---|
Code Block |
---|
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "semantic",
"fields": [
"alternativeTitles.alternativeTitle.*^1.0",
"contributors.name^1.0",
"identifiers.value^1.0",
"indexTitle.*^1.0",
"series.*^1.0",
"title.*^1.0"
],
"type": "best_fields",
"operator": "OR"
}
},
{
"multi_match": {
"query": "web",
"fields": [
"alternativeTitles.alternativeTitle.*^1.0",
"contributors.name^1.0",
"identifiers.value^1.0",
"indexTitle.*^1.0",
"series.*^1.0",
"title.*^1.0"
],
"type": "best_fields",
"operator": "OR"
}
},
{
"multi_match": {
"query": "primer",
"fields": [
"alternativeTitles.alternativeTitle.*^1.0",
"contributors.name^1.0",
"identifiers.value^1.0",
"indexTitle.*^1.0",
"series.*^1.0",
"title.*^1.0"
],
"type": "best_fields",
"operator": "OR"
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
}
} |
|
|
...