-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Multi-field and suggest api error #3469
Comments
Does it work if you search on title.title? |
That's true, it fails. But when using another sub field in multi field, it works fine: curl -XDELETE "http://localhost:9200/test?pretty"
curl -XPOST "http://localhost:9200/test?pretty" -d '{
"settings": {
"index": {
"number_of_replicas": 0,
"analysis":{
"analyzer":{
"suggest":{
"type": "custom",
"tokenizer": "standard",
"filter": [ "standard", "lowercase", "suggest_shingle" ]
}
},
"filter":{
"suggest_shingle":{
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 5,
"output_unigrams": true
}
}
}
}
}
}'
curl -XPOST "http://localhost:9200/test/test/_mapping?pretty" -d '{
"test": {
"properties" : {
"title": {
"path": "just_name",
"type": "multi_field",
"fields":
{
"title": {
"type": "string",
"index": "analyzed",
"similarity": "BM25",
"analyzer": "suggest"
},
"title_suggest": {
"type": "string",
"index": "analyzed",
"similarity": "BM25",
"analyzer": "suggest"
}
}
}
}
}
}'
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{
"title": "Just testing the suggestions api"
}'
curl -XPOST "http://localhost:9200/test/test?pretty&refresh" -d '{
"title": "An other title"
}'
curl -XGET "http://localhost:9200/test/test/_search?pretty" -d '{
"suggest": {
"text": "tetsting sugestion",
"phrase":{
"phrase":{
"field": "title_suggest",
"max_errors": 5
}
}
}
}' I'm going to look at it but I don't think you can use suggest with multifield and only one field declared under (the default one). |
I found the issue which is not exactly an issue. If you add a curl -XDELETE "http://localhost:9200/test?pretty"
curl -XPOST "http://localhost:9200/test?pretty" -d '{
"settings": {
"index": {
"number_of_replicas": 0,
"analysis":{
"analyzer":{
"suggest":{
"type": "custom",
"tokenizer": "standard",
"filter": [ "standard", "lowercase", "suggest_shingle" ]
}
},
"filter":{
"suggest_shingle":{
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 5,
"output_unigrams": true
}
}
}
}
}
}'
curl -XPOST "http://localhost:9200/test/test/_mapping?pretty" -d '{
"test": {
"properties" : {
"title": {
"path": "just_name",
"type": "multi_field",
"fields":
{
"title": {
"type": "string",
"index": "analyzed",
"similarity": "BM25",
"analyzer": "suggest"
}
}
}
}
}
}'
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{
"title": "Just testing the suggestions api"
}'
curl -XPOST "http://localhost:9200/test/test?pretty&refresh" -d '{
"title": "An other title"
}'
sleep 5
curl -XGET "http://localhost:9200/test/test/_search?pretty" -d '{
"suggest": {
"text": "tetsting sugestion",
"phrase":{
"phrase":{
"field": "title",
"max_errors": 5
}
}
}
}' |
Sorry. I was wrong. You have two issues here:
The following script is working fine: curl -XDELETE "http://localhost:9200/test?pretty"
curl -XPOST "http://localhost:9200/test?pretty" -d '{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis":{
"analyzer":{
"suggest":{
"type": "custom",
"tokenizer": "standard",
"filter": [ "standard", "lowercase", "suggest_shingle" ]
}
},
"filter":{
"suggest_shingle":{
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 5,
"output_unigrams": true
}
}
}
}
}
}'
curl -XPOST "http://localhost:9200/test/test/_mapping?pretty" -d '{
"test": {
"properties" : {
"title": {
"path": "just_name",
"type": "multi_field",
"fields":
{
"title": {
"type": "string",
"index": "analyzed",
"similarity": "BM25",
"analyzer": "suggest"
}
}
}
}
}
}'
curl -XPOST "http://localhost:9200/test/test?pretty" -d '{
"title": "Just testing the suggestions api"
}'
curl -XPOST "http://localhost:9200/test/test?pretty&refresh" -d '{
"title": "An other title"
}'
curl -XGET "http://localhost:9200/test/test/_search?pretty" -d '{
"suggest": {
"text": "tetsting sugestion",
"phrase":{
"phrase":{
"field": "title",
"max_errors": 5
}
}
}
}' I keep this issue opened to see if we can not fail in case of empty shards. |
Ah , yeah your right, i understand now why i received this error, it make sense... Math |
I've been noticing that suggestions fail on empty shards problem for the past few days. If no one gets to it the in next few days I'll have a crack at fixing the errors on empty shards. |
From elastic#3469. When running suggest on empty shards, it raises an error like: ``` "failures" : [ { "status" : 400, "reason" : "ElasticSearchIllegalArgumentException[generator field [title] doesn't exist]" } ] ``` We should ignore empty shards. Closes elastic#3473.
Unless the field is not mapped phrase suggester should return empty results or skip candidate generation if a field in not in the index rather than failing hard with an illegal argument exception. Some shards might not have a value in a certain field. Closes elastic#3469
reopening since this is really a different issue than having an entirely empty shard. here we can have no value in a field rather than having no docs. |
Unless the field is not mapped phrase suggester should return empty results or skip candidate generation if a field in not in the index rather than failing hard with an illegal argument exception. Some shards might not have a value in a certain field. Closes elastic#3469
Unless the field is not mapped phrase suggester should return empty results or skip candidate generation if a field in not in the index rather than failing hard with an illegal argument exception. Some shards might not have a value in a certain field. Closes #3469
From elastic#3469. When running suggest on empty shards, it raises an error like: ``` "failures" : [ { "status" : 400, "reason" : "ElasticSearchIllegalArgumentException[generator field [title] doesn't exist]" } ] ``` We should ignore empty shards. Closes elastic#3473.
Unless the field is not mapped phrase suggester should return empty results or skip candidate generation if a field in not in the index rather than failing hard with an illegal argument exception. Some shards might not have a value in a certain field. Closes elastic#3469
The following error occur while trying to do a simple phrase query on a multi-field using the suggest api:
And here is the code:
The text was updated successfully, but these errors were encountered: