Exact search not working with Nested multi field


(Shobhit Tyagi) #1

Hi Community,

I ran into an issue. I am trying to explore the multi field feature. If I use the following mapping, it all works well. I can search for exact match and fuzzy as well.

{
"mappings" : {
	"test" : {
		"properties" : {
			"value" : {
				"type" : "string",
				"fields": {
					"value-exact": { "type": "string", "index": "not_analyzed" }
				}
			}
		}
	}
}

}

However, if I group the field 'value' inside another then it doesnt really give me results for exact match. The mapping is following:

{
"mappings" : {
	"test" : {
		"properties" : {
			"topField" : {
				"properties" : {
					"value" : {
						"type" : "string",
						"fields": {
							"value-exact": { "type": "string", "index": "not_analyzed" }
						}
					}
				}
			}
		}
	}
}

}

I would really appreciate any help on this. Thanks.


(Shobhit Tyagi) #2

Anything on this please? Is this a bug/known issue?? Is there a work around? Thanks.


(Dan Tuffery) #3

Are you using Inner Objects or Nested Objects?

If you're using inner objects your mapping looks fine, what does your query look like? It should include the full path to the untokenized field:

{
    "query": {
        "term": {
            "topField.value.value-exact": "Elastic Search"
        }
    }
}

If you're using nested objects you will need to define the nested objects in your mapping and search using nested queries/filters.

Dan


(Shobhit Tyagi) #4

Thanks Dan.
Not nested. Inner objects.
Hmm. My query seems to be working if I use 'topField.value.value-exact'. Previously i was using 'topField.value-exact'.

But i dont get it. When I didnt have inner mapping, i just used 'value-exact'. And not 'value.value-exact'. And it was working fine. Why would it change for an inner object?


(system) #5