On the document multi-field search slow problem


(杨圆建) #1

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


(David Pilato) #2

Are you searching for departments or for organizations?

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


(杨圆建) #3

The problem has been updated, please see


(David Pilato) #4

Can you remove the highlighting part and test again?


(system) #5

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