I have an index set up for all my documents:
{
"mappings" {
"book" {
"_source": { "enabled": true },
"properties": [
"title": { "type": "string", "analyzer": "standard", "search_analyzer": "standard" },
"description": { "type": "string", "analyzer": "standard", "search_analyzer": "standard" },
"author": { "type": "string", "analyzer": "standard", "search_analyzer": "standard" }
]
}
}
}
I push this through into an index called "library".
What I want to do is execute a search with the following requirements. Assuming the user entered something like "big yellow shovel"
- Execute a search of user entered keywords in three ways:
- As is as a whole phrase: "simple yellow shovel"
- As a set of AND keywords: "simple+yellow+shovel"
- As a set of OR keywords: "simple|yellow|shovel"
- Ensure that the keyword sets executed in order of priority (boosted?):
- Full text first
- AND'd second
- OR'd third
Using a simple query works find for a single search:
{
"query": {
"simple_query_string": {
"query": "\"simple yellow shovel\""
}
}
}
How do I execute the multiple search with boosting? Or should I be using something like a "match" query on the indexed fields?
not_analyzed? It doesn't make sense. Always analyze field that you're going to run text search against. And you didn't prioritize your search fields. I assume matching title should have higher priority than match in description? - Evaldas Buinauskasnot_analyzedportion. That was a big ol' whoops. Prioritization I left out for brevity. - el n00b