Search based on joining Tokens

PUT /demo
{
"settings":{
"analysis": {
"analyzer": {
"xanalyzer": {
"type": "custom",
"tokenizer": "lowercase",
"filter": [
"mystopwords"
]
}},
"filter": {
"mystopwords": {
"type": "stop",
"stopwords":"the"
}
}
}
},
"mappings": {
"post" : {
"properties" : {
"title" : { "type" : "string", "analyzer" : "xanalyzer", "tokenizer": "lowercase", "filter": [
"mystopwords"
] }
}
}
}
}
PUT /demo/post/2
{
"title":"betaout is the kk krishna"
}
PUT /demo/post/1
{
"title":"kk the krishna"
}

GET /demo/post/_search
{
"query":{"match":{"title":"kk krishna"}}
}

I want result only the when i search it with kk krishna...not when i search it with "kk the krishna"..plzz suggest me some suggestion.

seems like you want to look for a phrase, meaning that you care about the position of the terms, not only about whether they appear or not. Try add the type:phrase to the match query I'd say.

1 Like