簡體   English   中英

ElasticSearch-嵌套字段的全文本搜索

[英]ElasticSearch - Full Text Search on nested fields

如果有人可以幫忙? 1.全文搜索查詢,其中標題和描述都是頂級字段

GET /docidx/Document/_search
{
    "query": {
        "query_string": {
            "query": "title:computer AND description:electronics"
        }
     }
}

This works fine.

2. The full text search query where title is top level field but "abstract.content" i.e content is a nested field under abstract - does not return results.

GET /docidx/Document/_search
{
  "query": {
       "query_string": {
          "query": "title:computer AND abstract.content:memory"
        }
    }
}

Does Elastic Search has support for full text search for nested fields?

使用mustnested Query組合:

GET /docidx/Document/_search
{
"query": {
  "bool": {
     "must": [
        {
           "query_string": {
              "default_field": "title",
              "query": "computer"
           }
        },
        {
           "nested": {
              "path": "abstract",
              "query": {
                 "query_string": {
                    "default_field": "abstract.content",
                    "query": "memory"
                 }
              }
           }
          }
       ]
       }
    }
  }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM