我有三个问题。
首先,我想知道是否可以使用单个查询将 mtermvectors 查询结果保存回新索引。
其次,如果第一个问题没问题,我想在保存结果时是否可以将当前格式更改为嵌套数据类型。
最后,我想知道是否可以同时进行聚合。是否可以?
现在,我的代码就在这里。
<pre>
GET /_mtermvectors?pretty=true
{
"docs":[
{ "_index": "test",
"_type": "type1",
"_id": "2",
"fields":["contents"],
"offsets":false,
"payloads":false,
"positions":false,
"term_statistics": true,
"field_statistics":true,
"filter":{
"min_term_freq":1,
"max_doc_freq": 3
} },
{ "_index": "test",
"_type": "type1",
"_id": "1",
"fields":["contents"],
"offsets":false,
"payloads":false,
"positions":false,
"term_statistics": true,
"field_statistics":true,
"filter":{
"min_term_freq":1,
"max_doc_freq": 3
}
} ] }
PUT /new_index
{
"mappings": {
"word": {
"properties": {
"termsarray": {
"type": "nested",
"properties": {
"form": {
"type":"text",
"fielddata": true
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
}
GET new_index/_search
{
"aggs" : {
"termsarray" : {
"nested" : {
"path" : "termsarray"
},
"aggs" : {
"word" : {
"terms" : {
"field" : "termsarray.form",
"order" : { "sum_score" : "desc" }
},
"aggs" : {
"sum_score" : { "sum" : { "field" : "termsarray.score" }}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
}
| 归档时间: |
|
| 查看次数: |
5419 次 |
| 最近记录: |