Created
October 14, 2017 10:56
-
-
Save randsina/4ded71ba27464c3905ff15a91ec3d8c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aggregations(manufacturers: { | |
terms: { | |
field: 'manufacturer.raw' | |
} | |
}, merchants: { | |
terms: { | |
field: 'merchant.raw' | |
} | |
}, categories: { | |
terms: { | |
field: 'category.raw' | |
} | |
}).suggest(didyoumean: { | |
text: options[:query], | |
phrase: { | |
size: 1, | |
max_errors: 0.5, | |
field: 'did_you_mean' | |
} | |
}).query( | |
bool: { | |
should: [{ | |
multi_match: { | |
query: options[:query], | |
fields: [ | |
"offer_description", | |
"offer_title^3", | |
"manufacturer^0.5", | |
"category^2", | |
"sub_category^2" | |
], | |
minimum_should_match: '75%' | |
} | |
}, { | |
multi_match: { | |
query: options[:query], | |
fields: [ | |
:category, | |
:sub_category | |
], | |
minimum_should_match: '80%' | |
} | |
}] | |
} | |
).min_score(0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment