0

I have index with field singers mapping like:

"singers": {
    "type": "string",
    "index_name": "singer",
    "analyzer": "unicode_analyzer"
}

Example data like:

"singers": [
    "Đàm Vĩnh Hưng",
    "Thanh Lam (NSƯT)"
]

Now I want to find if index has exactly singer name "Đàm Vĩnh Hưng", how can I do that?

Currently, I tried:

{
   "query": {
      "terms": {
         "singers": [
            "Đàm Vĩnh Hưng"
         ]
      }
   }
}

But the result is empty.

Any advice will be welcome. Thank you guys.

After tries, I resolved this when I use match_phrase. I will keep this for anyone who meet the same problem. Please close this. Thank you.

1
  • @Val Thank you for your help. Commented Dec 2, 2015 at 6:42

1 Answer 1

1

Use match_phrase.

{
   "query": {
      "match_phrase": {
         "singers": "Đàm Vĩnh Hưng"
      }
   }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.