Problems Ranking Results With Query Containing a Period

I have a brand and a part number field which I have indexed using ElasticSearch 7.3.

In my mapping, I have assigned a standard analyzer to my brand field and a custom analyzer that maps . to "" for my part_number field.

I have records with a brand of "Proform" & "Healthrider" each have a part number field with the value 220769 . When I query "Proform 220769" I receive the correct results. However, when I query "Proform 22076.9" I only receive "Healthrider" results. I have increased the boost on my brand field and when I do so I only see other proform products but not the one I have stored in my index with the corresponding part number.

Here are my fields:

{:properties=>{:brand=>{:type=>"text", :analyzer=>"standard"}, :part_number=>{:type=>"text", :analyzer=>"no_dots"}}

And my mapping:

settings index: { 
   number_of_shards: 1
 },
analysis: {

  analyzer: {

    no_dots: {
        tokenizer: "standard",
        char_filter: [
            "replace_dots"
        ],
        filter: ["lowercase"]
    }
  },
  "char_filter": {
        "replace_dots": {
            "type": "mapping",
            "mappings": [
                ". =>"
            ]
        }
    }

}

And my query:

{
   query:{
       
       multi_match:{
            fields: ["part_number", "brand"],
            query: "#{query}"
       }
                
   },highlight: {
        fields: {
           :"*" => {}
        }
   }
      
}

Just tried here with 7.2 and couldn't reproduce. All these queries work for me:

DELETE test
PUT test
{
  "settings": {
	"number_of_shards": 1,
	"analysis": {
	  "analyzer": {
		"no_dots": {
		  "tokenizer": "standard",
		  "char_filter": [
			"replace_dots"
		  ],
		  "filter": [
			"lowercase"
		  ]
		}
	  },
	  "char_filter": {
		"replace_dots": {
		  "type": "mapping",
		  "mappings": [
			". =>"
		  ]
		}
	  }
	}
  },
  "mappings": {
	"properties": {
	  "text": {
		"type": "text",
		"analyzer": "no_dots"
	  },
	  "brand": {
		"type": "text",
		"analyzer": "standard"
	  }
	}
  }
}
POST test/_analyze
{
  "analyzer": "no_dots",
  "text": "22076.9"
}
POST test/_doc
{
  "text":"22076.9",
  "brand":"Proform"
}
GET test/_search
{
   "query":{
   
	   "multi_match":{
			"fields": ["text", "brand"],
			"query": "Proform 22076.9"
	   }
   }
}
GET test/_search
{
   "query":{
   
	   "multi_match":{
			"fields": ["text", "brand"],
			"query": "Proform 220769"
	   }
   }
}
GET test/_search
{
   "query":{
   
	   "multi_match":{
			"fields": ["text", "brand"],
			"query": "220769"
	   }
   }
}
GET test/_search
{
   "query":{
   
	   "multi_match":{
			"fields": ["text", "brand"],
			"query": " 22076.9"
	   }
   }
}

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