我有以下弹性对象。
有没有办法运行全文搜索查询,如: 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"
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句