使用boosting的复杂嵌套数组搜索

7ivaypg9  于 2021-06-14  发布在  ElasticSearch
关注(0)|答案(0)|浏览(178)

所以我有一个弹性索引,有几千个文档,每个文档都有以下相当复杂的结构,我需要搜索如下:
假设我有以下搜索字符串:“我是单身,有一只狗”,我需要能够
搜索所有doc.ratedtags.tags.keywords和所有doc.describedtagcombos.tags.keywords,但在匹配的doc.ratedtags.tags.keywords中其评级同级具有更高的值
我认为这是不可能的

{
    "_index": "neighborhood",
    "_type": "neighborhood",
    "_id": "2338",
    "_version": 1,
    "_seq_no": 0,
    "_primary_term": 1,
    "found": true,
    "_source": {
        "id": 2338,
        "neighborhoodId": 4427,
        "name": "East Village",
        "xMin": -73.9926238051035,
        "xMax": -73.9718363715137,
        "xAvg": -73.9822300883086,
        "yMin": 40.7192801452175,
        "yMax": 40.7337200243512,
        "yAvg": 40.7265000847843,
        "city": {
            "id": 393,
            "name": "New York City-Manhattan",
            "county": "New York",
            "state": {
                "id": 118,
                "name": "New York",
                "abbreviation": "NY",
                "country": "USA"
            }
        },
        "ratedTags": [
            {
                "id": 1064,
                "rating": 4,
                "tags": [
                    {
                        "id": 213,
                        "tagId": 15,
                        "name": "restaurants",
                        "synonym": "",
                        "keywords": "restaurants, restaurant, eatery, eateries"
                    }
                ]
            },
            {
                "id": 995,
                "rating": 5,
                "tags": [
                    {
                        "id": 199,
                        "tagId": 1,
                        "name": "artists and creative types",
                        "synonym": "",
                        "keywords": "artsy, artistic, artists, creative types, musicians, artist, creative type, musician"
                    }
                ]
            }
        ],
        "describedTagCombos": [
            {
                "id": 9524,
                "descriptor": "Area has tons of excellent bars, restaurants, and fun that appeals to post-college, students, and creative types",
                "tags": [
                    {
                        "id": 213,
                        "tagId": 15,
                        "name": "restaurants",
                        "synonym": "",
                        "keywords": "restaurants, restaurant, eatery, eateries"
                    },
                    {
                        "id": 219,
                        "tagId": 21,
                        "name": "nightlife",
                        "synonym": "",
                        "keywords": "nightlife, bars, nightclubs, lounge, lounges, nightclub, bar, clubs, club, party, parties, night, pubs, tavern, sports bar, taverns, pub, wine bar, night life, night club, night clubs, sportsbar, sportsbars, night light, night lights, nightlight, nite light"
                    },
                    {
                        "id": 226,
                        "tagId": 28,
                        "name": "bar scene",
                        "synonym": "",
                        "keywords": "bar scene, bars, lounges, wine bar, lounge, pub, pubs, tavern, taverns"
                    },
                    {
                        "id": 238,
                        "tagId": 40,
                        "name": "dining options",
                        "synonym": "",
                        "keywords": "dining places, dining spots, dining options, restaurants, food options, food places, places to eat, eateries, dining, fast food, chain restaurant, chain restaurants, eatery"
                    }
                ]
            },
            {
                "id": 9525,
                "descriptor": "Traveler Tip: walk around St Marks and check out the shops, people, & vibe",
                "tags": [
                    {
                        "id": 235,
                        "tagId": 37,
                        "name": "tourist attractions",
                        "synonym": "sightseeing options",
                        "keywords": "tourist attractions, sightseeing, attractions, sightsee, tourist"
                    },
                    {
                        "id": 236,
                        "tagId": 38,
                        "name": "entertainment options",
                        "synonym": "fun options",
                        "keywords": "fun, entertainment, good time, enjoyment, enjoy, pleasure"
                    }
                ]
            }

        ]
    }
}
"_nayberz": {
      "type": "text",
      "analyzer": "autocomplete",
      "store": true
    },
...
"keywords": {
              "type": "text",
              "analyzer": "autocomplete",
              "copy_to": "_nayberz"
            },

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题