Skip to content

Support analysis aliases #603

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

Closed
micah-bloomerang opened this issue Apr 21, 2014 · 2 comments
Closed

Support analysis aliases #603

micah-bloomerang opened this issue Apr 21, 2014 · 2 comments
Assignees
Milestone

Comments

@micah-bloomerang
Copy link
Contributor

I'm trying to convert an existing code base to Nest, and I'm having trouble with the CreateIndex command. The command I'm trying to convert is this:

{ 
  "index": {
    "analysis": {
      "analyzer": {
        "default": {
          "type": "custom",
          "tokenizer": "uax_url_email",
          "filter": ["standard", "asciifolding", "lowercase", "stop"],
          "alias": ["default_index", "default_search"]
        }
      }
    }
  }
}

I think I want something that looks like:

client.CreateIndex(indexName, c => c
                .Analysis(a => a
                    .Analyzers(a2 => a2
                        .Add("default", new CustomAnalyzer() {
                            Tokenizer = "uax_url_email",
                            Filter = new List<string>() { "standard", "asciifolding", "lowercase", "stop" },
                            Alias = new List<string>() { "default_index", "default_search" }
                        }))));

but Alias isn't available on CustomAnalyzer. What's the best way to pull this off?

@micah-bloomerang
Copy link
Contributor Author

From what I can tell at http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-analyzers.html, the default customer analyzer affects both indexing and search; default_index and default_search only affect one or the other. If I'm setting the default analyzer, I shouldn't need to set default_index and default_search also. Maybe someone who knows more about ElasticSearch than I do can confirm?

@Mpdreamz
Copy link
Member

You are right that in your case you do not need the aliasing to make it the default on index and search time.

Reopening this because you should be able to set the alias as you specified.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-analyzers.html#aliasing-analyzers

@Mpdreamz Mpdreamz reopened this Apr 21, 2014
@Mpdreamz Mpdreamz changed the title Question: CreateIndex command Support analysis aliases Apr 21, 2014
@Mpdreamz Mpdreamz added this to the NEST 1.0 RC milestone Jun 16, 2014
@gmarz gmarz self-assigned this Jun 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants