Return wrong result which not necessary

Hi my request is bellow,

{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "fields": [
              "keywords"
            ],
            "query": "*hi \\&\\& hi*",
            "default_operator": "AND",
            "analyze_wildcard": true
          }
        }
      ]
    }
  },
  "from": 0,
  "size": 5000
}

Then I Got result

    {
      "took": 2,
      "timed_out": false,
      "_shards": {
        "total": 5,
        "successful": 5,
        "failed": 0
      },
      "hits": {
        "total": 2,
        "max_score": 4.0767765,
        "hits": [
          {
            "_index": "test",
            "_type": "PersonSearch",
            "_id": "jdhsakdhsjklaaldhsj",
            "_score": 4.0767765,
            "_source": {
              "keywords": [
                "novella",
                "degroot",
                "novella degroot",
                "novella_degroot@degroot.org",
                "808-477-4775",
                "808-746-1865",
                "Possible",
                "evans, c kelly esq",
                "employee",
                "evans, c kelly esq",
                "employee",
                "303 n radcliffe st",
                "hilo",
                "hawaii",
                "hi",
                "96720",
                "hilo",
                "hawaii",
                "hi",
                "303 n radcliffe st",
                "96720",
                "http://www.evansckellyesq.com",
                "green p"
              ]
            }
          },
          {
            "_index": "test",
            "_type": "PersonSearch",
            "_id": "new xyz",
            "_score": 4.0767765,
            "_source": {
              "keywords": [
                "c",
                "kannan",
                "c kannan",
                "Possible",
                "ransar industries, unit-ii(mfg)",
                "employee",
                "imported 26/02/2016 2:06 pm",
                "2011-10-19 05:59:55 - sandip mavani  - cimco wireless dnc system for 1 m/c",
                **"hi && hi"**
              ]
            }
          }
        ]
      }
    }

but I want actually only second record.

Hi,

two things come to my mind:

  • the && you are trying to search is filtered out during the analysis phase when using the default standard analyzer which in turn uses the standard tokenizer. You might want to try the whitespace analyzer, which you can luckily set using the analyzer parameter for the query_string query
  • from your example it looks like you are looking for phrases and not just a simple AND of the three search tokens. However, I don't think wildcards will work in phrases for query_string queries

hi @cbuescher
What Thing i do In my request to Fix this Issue.
I Only Want Second One Record.