0

I am working on elastic search in node.js. I have 50k+ users in elstic search and now I have an of of phone numbers. Now I want to get those users from elastic search who match these number in array for this purpose I write search query string but this query give me exception I don't know where I am doing mistake in my query string.

Query String

{
  "query": {
    "bool": {
      "must": [
        { 
          "prefix": {
              "phone":{"+9665509548","+93565822145",...}
          }
        }
      ]
    }
  }
}
2
  • It's impossible to answer this without knowing your index mapping and the actual error message, so please provide those. Commented Jan 26, 2018 at 10:38
  • On top of that, your query simply isn't valid JSON. You need to have a {"phone": "value"} dict object under prefix Commented Jan 26, 2018 at 10:39

1 Answer 1

1

Is this what you're after?

{
  "query": {
    "bool": {
      "should": [
        { 
          "prefix": {
              "phone": "+9665509548"
          }
        },
        { 
          "prefix": {
              "phone": "+93565822145"
          }
        },
        //...
      ],
      "minimum_should_match": 1
    }
  }
}
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.