Not analyze at (new) fields with all types in index

Hi,

I'm pretty new to elasticsearch and already archived some goals but now I stuck.

All existing fields and all ever created fields on a type in an Index should always not be indexed no matter the type (string etc.) of the field.

I need this for exact search results like when I have two entries "Foo bar" and "bar" and search for "bar" I just want the result "bar"

I thought it could work with a mapping like that:

type_name : {
       dynamic_templates : [{
		notanalyzed : {
			match: "*",
			mapping: {
				index: "not_analyzed"
			} 
		}
	}]
}

but it does not seem to work, I still find "foo bar" while searching for "bar". Any thoughts?

You may be doing something like putting the docs into a different type/index or the docs are going into a different mapping based upon something overriding it. I've just copied your example and set up a sample document/query to https://gist.github.com/eskibars/2a1e91454eb4fc4a88860cc80ea09acd which works.

If you want to debug why it's not working, you might want to do a GET /yourindex to make sure type_name is set as you expected. You might also want to inspect the _index and _type at the result hits from a query you don't expect the documents to match on and see if they may not be added to the right index/type.