-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not_analyzed has no effect #55
Comments
I've updated the tests but all seems well: Can you gist your GetMapping() response and your search request + response ? if you also specify `SearchAnalyzer="keyword", IndexAnalyzer="keyword" are you getting better results ? Note that this should not be necessary though. |
Hey Robert, I've committed even more explicit tests: Which seem to indicate everything is working like it should. Can you run those test and confirm they are working for you too? Can you gist your entity class, index code, search code ? Privately would be fine too just sent me an email at my github account name @ gmail Perhaps we can even schedule a teamviewer (or something of the sort) session to debug this? |
Thanks, I appreciate you taking the time to help. Here are my answers:
Of course: https://gist.github.com/0f9bdcdd7e444d7dedc5. (Don't pay attention to the double entries for some products in the response. That's just test data.)
No, the results stay the same.
I've ran the tests and they all pass.
The search code is part of a larger project. I'll try to reduce the code to a smaller case that reproduces this behaviour, so it's easier to debug. I'll let you know. |
Can you also gist your class, code that does the mapping ? |
I've created an MVC project with a simple piece of indexing and search code where not_analyzed does not work. If you run it and press the "Add"-button, it indexes a product, and you should see a facet with two values instead of the expected one. |
Appreciate the effort in setting that up! Helped me find the issue quickly. It seems ElasticSearch no longer creates an index if it doesn't exist on the mapping call but will do so on the add call. So the mapping call threw a 500 but the index call still happened creating a default mapping. On later add calls the mapping call still throws a 500 but now it complaints it cant update the mapping because it can't handle changing indexing options. I've sent a pull request that creates the index on application_start and now all seems well. Handling updated schema versions updates is probably the most dificult thing in search systems (not just elasticsearch's problem) and the only way to manage it a bit in Elasticsearch is using it's aliasing mechanism (which NEST supports) and reindexing on big schema changes. Elasticsearch can update and merge quite a lot of schema changes though, Analysis settings is not one of them though. |
Thanks for your help. So the trick is to create the index before persisting the mapping. Seems like an easy fix. I don't necessarily want to have lots of schema updates, and the ElasticSearch code in my original web app actually tries to avoid that. It's just that this example code demonstrates the issue. I did try to only do a mapping when there's no mapping present, but |
Yikes, pull request are always welcome! |
@Mpdreamz it would be nice to add a remark to NEST docs, probably. I was looking at this page http://nest.azurewebsites.net/indices/put-mapping.html and didn't manage to understand what else should I do to make the attributes work. But, on the other hand, nobody else has complained about that for 2 years, so, maybe I'm doing something wrong? Is creating the index explicitly considered a preferred way of working with NEST? |
i too have hit this problem (i.e. not being clear in the docs). |
I've run into this problem as well. |
same problem here. anyone got the solution? |
@rajatg64 it'd be best to open a new issue and describe what the problem you're seeing is. |
I'm trying to tell ElasticSearch to stop analyzing a certain property, to prevent values with a dash from being split. I tried the options I could find, but none of them work. Have I stumbled upon a bug in NEST or am I doing something wrong? Let me tell you what I've tried so far.
Mapping with ElasticProperty
The NEST docs tell me I can use the ElasticProperty attribute with a FieldIndexOption.
When the
Index
method has been called, I can see the product has been correctly indexed and the mapping is created in ElasticSearch. However, when I perform a faceted search, the value is still split. (The facet value "E-book" becomes two: "E" and "Book".)Manually call the mapper method
I found issue #19 that told me to persist the mapping, so I did:
It creates a mapping, but the value is still split.
Explicit type mapping
Then I tried to perform an explicit type mapping, as mentioned in issue #19.
That doesn't prevent the value from being split either.
I'm running this with:
If you need me further to debug this or provide any more information, just let me know.
The text was updated successfully, but these errors were encountered: