Issue 1:
"version" : {
"number" : "1.4.4",
"lucene_version" : "4.10.3"
}

I have about 20m database of keywords such as:

"car" (weight is 100)

"buy car" (weight is 50)

"buy used car" (weight is 10)

...

each keyword having weight equal popularity. Initial mapping is:

PUT /suggestions/search/_mapping
{
"search": {
"properties": {
"suggest": {
"type": "completion",
"analyzer": "standard"
}
}
}
}

And indexing is simple:

PUT /suggestions/search/1
{
"name": "car"
"suggest": {
"input": "car",
"weight": 100
}
}

So, considering the above list, when I type "car" I will only get "car" query. It worked fine as long as I did not want to look up words in middle of phrase. The solution I have found is split keyword to words and add them ti suggestion input as array:

PUT /suggestions/search/1
{
"name": "buy used car"
"suggest": {
"input": ["buy", "used", "car"],
"weight": "10"
}
}

Now when I type "car" I can find all of three keywords correctly sorted by weight. The solution was very rapid, much faster then any other elasticsearch autocompletion features. But then there was a big problem.

When I reached 200k different keywords related to "car" (indexing arrays like [best, car, buy], [car, rental], [used,car,sale], etc...), I have problem with sorting by weight. When I make query:

GET /suggestions/_suggest
{
"text" : "car",
"completion": {
"field": "suggest"
}
}

The results are sorted in wrong order. The weight (imagine that top keyword "car" has 200k weight and bottom is 1) is shifted randomly and first result has a weight of 100-180k instead of 200k.

You can reproduce this by creating index in loop (pseudo-code):

for ($i=1;$i<200000;$i++)
{

PUT /suggestions/search/$i
{
"name": "$i"
"suggest": {
"input": ["test", "$i"], // $i as second word is needed otherwise results will be merged
"weight": $i
}
}

}

Then try to search "test" and you can see something like this:

{
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"suggest": [
{
"text": "test",
"offset": 0,
"length": 4,
"options": [
{
"text": "179992",
"score": 179992
},
{
"text": "179940",
"score": 179940
},
{
"text": "179868",
"score": 179868
},
{
"text": "179820",
"score": 179820
},
{
"text": "179696",
"score": 179696
}
]
}
]
}

As you can see, first result is 179992, not 200000. Of course the top weight is 200k and index contains 200k elements. What could be the problem? This is feature of FST working or just a bug?

Issue 2:
Elasticsearch version: Elasticsearch 5.0.0-alpha2

JVM version: Java 8.0

OS version: Linux

Description of the problem including expected versus actual behavior:

Based on documentation, I see that we can make use of discovery.ec2.tag in the EC2 discovery plugin as a Prefix to filter down the EC2 instances to be included in the discovery process. I created a tag by name Stage with value as DEV-ELK in EC2 instances in AWS and I included the following setting in latest Elasticsearch 5.0.0-alpha2 release

discovery.ec2.tag.Stage=DEV-ELK

But while starting up Elastic Search instance after including the above tag in elasticsearch.yml file, it complains Exception in thread "main" java.lang.IllegalArgumentException: unknown setting [discovery.ec2.tag.Stage]

Steps to reproduce:

1.Create EC2 instances with Tag as Stage and Value as DEV-ELK

2.Configure elasticsearch.yml file to use Discovery Plugin and include the following setting to filter down the instance discovery.ec2.tag.Stage=DEV-ELK

3.Restart the Elastic Search instance. As soon as you start, you will see the following error pasted in logs section

Provide logs (if relevant):

Exception in thread "main" java.lang.IllegalArgumentException: unknown setting [discovery.ec2.tag.Stage]

at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:267)

at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:238)

at org.elasticsearch.common.settings.SettingsModule.configure(SettingsModule.java:120)

at <<>>

at org.elasticsearch.node.Node.(Node.java:235)

at org.elasticsearch.node.Node.(Node.java:161)

at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:188)

at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:188)

at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:267)

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:111)

at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:106)

at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91)

at org.elasticsearch.cli.Command.main(Command.java:53)

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:74)

at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67)