Search and partial search using or not special characters

Hello,

I have something like this:

"documents" : {
            "type1" : "341.943-61",
            "type2" : "5.6-0"
          }

But the user is not require to input it with special characters, so, it can be something like this:

"documents" : {
            "type1" : "34194361",
            "type2" : "560"
          }

So now, I need to be able to retrieve both results, if the user input something like:

documents.type1 = 34194361

Or partial, like:

documents.type1 = 4194

I tried:

GET myBase/_search
{
  "from":0,
  "size":10,
  "query": {
    "term": {
      "documents.type1.raw":  "34194361"
      
    }
  }
}

But it didn't work, it returns nothing. The exact search I'm able to retrieve using "keyword" in kibana.

I get the same results using Nest (.Net)
(field would be the documents.type1 and value would be 34194361)

var searchResponse = await _elasticContext.Client.SearchAsync<Customer>(s => s
                                                                  .From(skip)
                                                                  .Size(limit)
                                                                  .Query(qu => qu
                                                                        .MultiMatch(mm => mm
                                                                            .Fields(f => f
                                                                                .Field(field))
                                                                            .Query($"{value.Trim()}")
                                                                            .Type(TextQueryType.BoolPrefix))
                                                                    ));

Thank you for the help.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.