On the document multi-field search slow problem

Problem Description

A document in the organization's index that contains all the department collections for this organization, such as

{
    id:1,
    org_name:'Google',
    department_list:[
       {
           id: 1,
           name: 'financial department'
           ... (7 fields more)
       }
       ......(41666 object more )
   ]
}

But the document contains 41666 departments, because too many departments lead to search is very slow, search results time 43s, please provide the idea to solve the problem, thank your!

Whole Mapping

https://github.com/elastic/elasticsearch/issues/26796

Query DSL

{
    "size": 10,
    "query": {
        "bool": {
            "must": [
                {
                    "match_phrase": {
                        "_all": "tech"
                    }
                }
            ],
            "should": [
                {
                    "match_phrase": {
                        "name": {
                            "boost": 100,
                            "query": "tech"
                        }
                    }
                }
            ]
        }
    },
    "highlight": {
        "fields": {
            "*": {
                "pre_tags": [
                    "<em class=\"es-search-highlight\">"
                ],
                "post_tags": [
                    "</em>"
                ],
                "require_field_match": "false"
            }
        }
    }
}

OS Configuration

CPU: 2 Core 4 Thread
Memory: 4 GB
OS version: Ubuntu 16.5
Running environment:Rancher

Are you searching for departments or for organizations?

What is the mapping? What does a query look like?

The problem has been updated, please see

Can you remove the highlighting part and test again?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.