Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Запрос 1:
POST tenders_2019/_doc/_search
{
"_source": false,
"timeout": "3m",
"query": {
"bool": {
"filter": [
{
"bool": {
"should": [
{
"bool": {
"filter": [
{
"has_child": {
"type": "document",
"score_mode":"none",
"inner_hits": {
"size": 10
},
"query": {
"bool": {
"should": [
{
"span_near": {
"clauses": [
{
"span_multi": {
"match": {
"prefix": {
"fileContent": {
"value": "молок",
"rewrite": "top_terms_4096"
}
}
}
}
},
{
"span_multi": {
"match": {
"prefix": {
"fileContent": {
"value": "натур",
"rewrite": "top_terms_4096"
}
}
}
}
}
],
"slop": 10,
"in_order": false
}
}
]
}
}
}
},
{
"terms": {
"number": [
"0120300001719000010"
]
}
}
]
}
}
]
}
}
]
}
},
"sort": {
"dateBegin": {
"order": "desc"
}
},
"from": 0,
"size": 50
}
Ответ содержит inner_hits:
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 6,
"successful": 6,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1,
"max_score": null,
"hits": [
{
"_index": "tenders_2019",
"_type": "_doc",
"_id": "tender_33058543",
"_score": null,
"sort": [
1547746740000
],
"inner_hits": {
"document": {
"hits": {
"total": 2,
"max_score": 167.30325,
"hits": [
{
"_index": "tenders_2019",
"_type": "_doc",
"_id": "document_77837293",
"_score": 167.30325,
"_routing": "tender_33058543",
"_source": {
"docId": 156398028,
"document": {
"name": "document",
"parent": "tender_33058543"
},
"name": "Обоснование НМЦк СОШ 251 на 2019 год.pdf",
"contentLength": 8240,
"id": 77837293,
"source": "Обоснование НМЦк СОШ 251 на 2019 год.1.rar"
}
},
{
"_index": "tenders_2019",
"_type": "_doc",
"_id": "document_77837199",
"_score": 167.30325,
"_routing": "tender_33058543",
"_source": {
"docId": 156398013,
"document": {
"name": "document",
"parent": "tender_33058543"
},
"name": "Обоснование НМЦк СОШ 251 на 2019 год.pdf",
"contentLength": 8240,
"id": 77837199,
"source": "Обоснование НМЦк СОШ 251 на 2019 год.rar"
}
}
]
}
}
}
}
]
}
}
Запрос 2:
POST tenders_2019/_doc/_search
{
"_source": false,
"timeout": "3m",
"query": {
"bool": {
"filter": [
{
"bool": {
"should": [
{
"bool": {
"filter": [
{
"has_child": {
"type": "document",
"score_mode":"none",
"inner_hits": {
"size": 10,
"name": "first"
},
"query": {
"bool": {
"should": [
{
"span_near": {
"clauses": [
{
"span_multi": {
"match": {
"prefix": {
"fileContent": {
"value": "молок",
"rewrite": "top_terms_4096"
}
}
}
}
},
{
"span_multi": {
"match": {
"prefix": {
"fileContent": {
"value": "натур",
"rewrite": "top_terms_4096"
}
}
}
}
}
],
"slop": 10,
"in_order": false
}
}
]
}
}
}
},
{
"terms": {
"number": [
"0120300001719000010"
]
}
}
]
}
},
{
"bool": {
"filter": [
{
"has_child": {
"type": "document",
"score_mode":"none",
"inner_hits": {
"size": 1,
"name": "second"
},
"query": {
"bool": {
"should": [
{
"span_near": {
"clauses": [
{
"span_multi": {
"match": {
"prefix": {
"fileContent": {
"value": "смета",
"rewrite": "top_terms_4096"
}
}
}
}
},
{
"span_multi": {
"match": {
"prefix": {
"fileContent": {
"value": "жир",
"rewrite": "top_terms_4096"
}
}
}
}
}
],
"slop": 10,
"in_order": false
}
}
]
}
}
}
},
{
"terms": {
"number": [
"0358200035519000006"
]
}
}
]
}
}
]
}
}
]
}
},
"sort": {
"dateBegin": {
"order": "desc"
}
},
"from": 0,
"size": 50
}
Ответ не содержит inner_hits:
{
"took": 23,
"timed_out": false,
"_shards": {
"total": 6,
"successful": 6,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 2,
"max_score": null,
"hits": [
{
"_index": "tenders_2019",
"_type": "_doc",
"_id": "tender_33058543",
"_score": null,
"sort": [
1547746740000
],
"inner_hits": {
"document": {
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
}
},
{
"_index": "tenders_2019",
"_type": "_doc",
"_id": "tender_33059452",
"_score": null,
"sort": [
1547719620000
],
"inner_hits": {
"document": {
"hits": {
"total": 4,
"max_score": 635.50946,
"hits": [
{
"_index": "tenders_2019",
"_type": "_doc",
"_id": "document_77837537",
"_score": 635.50946,
"_routing": "tender_33059452",
"_source": {
"docId": 156399288,
"document": {
"name": "document",
"parent": "tender_33059452"
},
"name": "b3931cf5-233b-417d-9113-e7be5957b779.docx",
"contentLength": 9021,
"id": 77837537,
"source": "РАЗДЕЛ II СПЕЦИФИКАЦИЯ молочные продукты.docx"
}
}
]
}
}
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.