Wildcard and Fuzzy together

I would like to do both wildcard and fuzzy search for a text in one call to Atlas cluster. Is there an example I can follow to do it?

This is something I tried:

{
  index: 'test',
  "compound": {
     "must":[
                {
                  "wildcard": {
                    "query": "blo*",
                    "path": "Text",
                    allowAnalyzedField: true
                  }
                },
                  {
          text: {
            query: "blo",
            path: "Text",
            fuzzy: {'maxEdits':2.0}
          }
        }
                ]
  }
}

Thank you,
Supriya

Hi @Supriya_Bansal I tried this query and wasn’t able to reproduce. Maybe revisit your index definition. Here’s my test query:

  index: 'default',
  "compound": {
     "must":[
                {
                  "wildcard": {
                    "query": "Soho*",
                    "path": "name",
                    allowAnalyzedField: true
                  }
                },
                  {
          text: {
            query: "Clan",
            path: "summary",
            fuzzy: {'maxEdits':2}
          }
        }
      ]
  }
}

Using the sample_airbnb.listingsAndReviews sample dataset in Atlas, I also used this index definition:

  "mappings": {
    "dynamic": false,
    "fields": {
      "name": {
        "analyzer": "lucene.keyword",
        "type": "string"
      },
      "summary": {
        "type": "string"
      }
    }
  }
}

I hope this helps. Let me know! :slight_smile: