Skip to content
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

Inconsistent naming of "filter" vs. "filters" when defining analyzer on an index vs. specifying its parameters inline #16450

Closed
fsoikin opened this issue Feb 4, 2016 · 2 comments

Comments

@fsoikin
Copy link

fsoikin commented Feb 4, 2016

In the snippet below, index analyzertest1 has an analyzer defined with filters, and analyzertest2 - with filter. The latter works, the former doesn't (see also #16451).

When I specify filters inline, the situation is reversed: filters works, filter doesn't.

post analyzertest1
  {
    "settings": {
        "analysis": {
            "analyzer": {
                "my_analyzer": {
                    "tokenizer": "standard",
                    "filters": ["lowercase"]
                }
            }
        }
    }
  }

post analyzertest1/_analyze 
{
   "analyzer": "my_analyzer", "text": "ABCD"
}
// Result: "ABCD"

post analyzertest2
  {
    "settings": {
        "analysis": {
            "analyzer": {
                "my_analyzer": {
                    "tokenizer": "standard",
                    "filter": ["lowercase", "stop"]
                }
            }
        }
    }
  }

post analyzertest2/_analyze 
{
   "analyzer": "my_analyzer", "text": "ABCD"
}
// Result: "abcd"

post _analyze 
{
   "tokenizer": "standard",
   "filter": ["lowercase"],
   "text": "ABCD" 
}
// Result: error "unknown parameter [filter]"

post _analyze 
{
   "tokenizer": "standard",
   "filters": ["lowercase"],
   "text": "ABCD" 
}
// Result: "abcd"
@fsoikin
Copy link
Author

fsoikin commented Feb 4, 2016

/cc: @markharwood

@javanna
Copy link
Member

javanna commented Feb 9, 2016

I think there are two problems here:

  1. we don't validate (yet) analyzer settings, so non valid ones are accepted and stored in the cluster state. Same as Defining analyzer on index doesn't complain about unknown parameters #16451 .

  2. analyze api and create index api are inconsistent, same as analyze api accepts "filters" while create index relies on "filter" #15189.

I will close this issue as duplicate then as we already have specific issues for each of the corresponding problems. Thanks for opening this though ;)

@javanna javanna closed this as completed Feb 9, 2016
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

2 participants