es query 2

mail@pastecode.io avatar
unknown
json
2 years ago
10 kB
5
Indexable
Never
GET /segment_99/_search
{"query": {
        "bool": {
            "should": [
                {"match": {"user_id": 4903113}},
                {"nested": {
                    "path": "ranking.points",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.points.rank": 1000}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.points",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.points.rank": 500}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.points",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.points.rank": 100}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.points",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.points.rank": 50}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.points",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.points.rank": 10}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.points",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.points.rank": 3}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.points",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.points.rank": 1}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.stamps",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.stamps.rank": 1000}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.stamps",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.stamps.rank": 500}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.stamps",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.stamps.rank": 100}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.stamps",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.stamps.rank": 50}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.stamps",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.stamps.rank": 10}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.stamps",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.stamps.rank": 3}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.stamps",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.stamps.rank": 1}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.vouchers",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.vouchers.rank": 1000}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.vouchers",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.vouchers.rank": 500}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.vouchers",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.vouchers.rank": 100}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.vouchers",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.vouchers.rank": 50}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.vouchers",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.vouchers.rank": 10}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.vouchers",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.vouchers.rank": 3}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.vouchers",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {
                                    "ranking.vouchers.rank": 1}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.visits",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.visits.rank": 1000}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.visits",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.visits.rank": 500}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.visits",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.visits.rank": 100}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.visits",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.visits.rank": 50}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.visits",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.visits.rank": 10}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.visits",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.visits.rank": 3}}
                            ]
                        }
                    }
                }},
                {"nested": {
                    "path": "ranking.visits",
                    "query": {
                        "bool": {
                            "must": [
                                {"match": {"ranking.visits.rank": 1}}
                            ]
                        }
                    }
                }}
            ]
        }
    },
        "_source": ["user_id", "ranking"]
    }