Elasticsearch query timeout

I am running an ES node on a 8 cores/16G RAM Qbox server.
I am doing some indexing and search operations. indexing(max 5/second), search(max 14/second). My index has around 2M records and 1.2G of data. Search query takes around 300ms median.
I am puzzled on why the server can not handle even such a low traffic.

Bellow is my mapping and the query I am sending:
Mapping:

{
"orders_prod-1586935194034930": {
    "mappings": {
    "_doc": {
        "dynamic": "true",
        "properties": {
        "address_id": {
            "type": "long"
        },
        "card_4_digits": {
            "type": "keyword"
        },
        "card_type": {
            "type": "keyword"
        },
        "channel_id": {
            "type": "integer"
        },
        "created_at": {
            "type": "date",
            "format": "strict_date_hour_minute_second"
        },
        "customer_email": {
            "type": "keyword"
        },
        "customer_name": {
            "type": "keyword"
        },
        "customer_name_text": {
            "type": "text"
        },
        "customer_phone": {
            "type": "keyword"
        },
        "delivery_address": {
            "type": "keyword"
        },
        "favorite": {
            "type": "boolean"
        },
        "has_promo_discount": {
            "type": "boolean"
        },
        "id": {
            "type": "long"
        },
        "ivr_code": {
            "type": "keyword"
        },
        "order_at": {
            "type": "date",
            "format": "strict_date_hour_minute_second"
        },
        "order_type": {
            "type": "keyword"
        },
        "payment_type": {
            "type": "keyword"
        },
        "placed_at": {
            "type": "date",
            "format": "strict_date_hour_minute_second"
        },
        "restaurant_id": {
            "type": "integer"
        },
        "short_uuid": {
            "type": "keyword"
        },
        "state": {
            "type": "keyword"
        },
        "subtotal": {
            "type": "integer"
        },
        "total": {
            "type": "integer"
        },
        "updated_at": {
            "type": "date",
            "format": "strict_date_hour_minute_second"
        },
        "user_id": {
            "type": "integer"
        },
        "uuid": {
            "type": "keyword"
        },
        "workflow_color": {
            "type": "keyword"
        },
        "workflow_node_id": {
            "type": "keyword"
        },
        "workflow_node_name": {
            "type": "keyword"
        },
        "workflow_tag": {
            "type": "keyword"
        }
        }
    }
    }
}
}

The query:

{
"from":0,
"size":20,
"query":{
    "bool":{
        "must":[
            {
            "bool":{
                "should":[
                    {
                        "term":{
                        "user_id":{
                            "value":308612,
                            "boost":1.0
                        }
                        }
                    },
                    {
                        "term":{
                        "restaurant_id":{
                            "value":8898,
                            "boost":1.0
                        }
                        }
                    },
                    {
                        "term":{
                        "restaurant_id":{
                            "value":4164,
                            "boost":1.0
                        }
                        }
                    },
                    {
                        "term":{
                        "restaurant_id":{
                            "value":4679,
                            "boost":1.0
                        }
                        }
                    }
                ],
                "adjust_pure_negative":true,
                "minimum_should_match":"1",
                "boost":1.0
            }
            }
        ],
        "must_not":[
            {
            "term":{
                "state":{
                    "value":"created",
                    "boost":1.0
                }
            }
            }
        ],
        "should":[
            {
            "bool":{
                "should":[
                    {
                        "term":{
                        "state":{
                            "value":"executing",
                            "boost":1.0
                        }
                        }
                    },
                    {
                        "term":{
                        "state":{
                            "value":"missed",
                            "boost":1.0
                        }
                        }
                    }
                ],
                "adjust_pure_negative":true,
                "minimum_should_match":"1",
                "boost":1.0
            }
            }
        ],
        "adjust_pure_negative":true,
        "minimum_should_match":"1",
        "boost":1.0
    }
},
"_source":{
    "includes":[
        "short_uuid",
        "uuid",
        "state",
        "restaurant_id",
        "channel_id",
        "customer_name_text",
        "total",
        "payment_type",
        "card_type",
        "order_at"
    ],
    "excludes":[

    ]
},
"sort":[
    {
        "order_at":{
            "order":"asc"
        }
    },
    {
        "created_at":{
            "order":"desc"
        }
    }
]
}

Is there something I can do? maybe the query is not optimum at all. I would really need some hints.

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