[英]Elasticsearch search with nested objects
我在彈性中有以下 object。
有沒有辦法運行全文搜索查詢,例如: Fizz AND bar
{
"258": "Fizz buzz",
"12416": [
{
"161": 54,
"273": "text doc.txt",
"544": [
"text/plain"
],
"12290": "foo bar",
}
]
}
我已經閱讀了有關運行時字段的信息,但它僅支持關鍵字類型,並且僅在完全匹配的情況下才有效。
查詢字符串不適用於嵌套字段。 您可以使用嵌套查詢或實現自定義_all 字段
PUT index117
{
"mappings": {
"properties": {
"_all":{
"type": "text"
},
"258":{
"type": "text",
"copy_to": "_all" --> copies data to _all field
},
"12416":{
"type": "nested",
"properties": {
"12290":{
"type":"text",
"copy_to": "_all"
}
}
}
}
}
}
POST index117/_doc
{
"258": "Fizz buzz",
"12416": [
{
"161": 54,
"273": "text doc.txt",
"544": [
"text/plain"
],
"12290": "foo bar"
}
]
}
GET index117/_search
{
"query": {
"query_string": {
"default_field": "_all",
"query": "foo AND bar"
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.