Hi everyone,
My goal is to make a search engine for my data that look like "ta AND tb OR (tc AND td)"
I'm focusing on the part "ta AND tb".
{
"id": 1,
"keywords": ["java", "node", "PHP"]
},
{
"id": 2,
"keywords": ["javascript", "node", "PHP"]
},
{
"id": 3,
"keywords": ["java", "node.js", "PHP"]
},
{
"id": 4,
"keywords": ["java/j2ee", "node", "PHP"]
},
{
"id": 5,
"keywords": ["java node", "spring", "PHP"]
}
With the query "java AND node". I'd like to have the 1, 3, 5, 4 then 2.
I try with
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "java",
"fields": [
"keywords^5",
"keywords.ngram"
]
},
"multi_match": {
"query": "node",
"fields": [
"keywords^5",
"keywords.ngram"
]
}
}
]
}
}
}
and with
{
"query": {
"bool": {
"must": [
{
"match_phrase": {
"keywords": "java"
}
},
{
"match_phrase": {
"keywords": "node"
}
}
]
}
}
}
I use a tokenizer with ngram (min: 1, max 40, token_chars: [letter, digit]
How could I perform my request as I expect? Do you any documentation I could use and tips?
Thanks for reading.