1

So I have an elastic index with a few thousand docuemnts each with the following rather complex structure which I need to search as follows:

lets say I have the following search string : "I am single and have a dog", I need to be able to

search all doc.ratedTags.tags.keywords and all doc.describedTagCombos.tags.keywords, but giving a boost to matched doc.ratedTags.tags.keywords where its rating sibling has a higher value

tbh i don't think its even possible

{
    "_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"
            },
1977
  • 2,580
  • 6
  • 26
  • 37
  • Hi, I didnot understand well. you need to search "I am single and have a dog" on tags it means that you need to search each word of your search query on tags? If you want to just search on both lists it is possible. if you just want this please tell me to add the search query for you. Thanks! – Saeed Nasehi Oct 23 '20 at 21:05
  • 1
    @1977 can you please share your index mapping and expected search result ? – ESCoder Oct 24 '20 at 01:31
  • added mapping example above,, but it clearly needs a total overhaul @Bhavya – 1977 Oct 25 '20 at 20:43

0 Answers0