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

Context Suggester Issues/Exceptions #5525

Closed
spinscale opened this Issue Mar 25, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@spinscale
Member

spinscale commented Mar 25, 2014

The context suggester seems to have a couple of bugs in the geo impl - when working according to the docs I could not create working suggestions.

This example does not return any suggestions (but it should return the one in Amsterdam)

DELETE venues
PUT venues

GET venues/_mapping
PUT venues/poi/_mapping
{
  "poi" : {
    "properties" : {
      "suggest_field": {
        "type": "completion",
        "context": {
          "loc": { 
            "type": "geo",
            "precision" : "10km"
          }
        }
      }
    }
  }
}

PUT venues/poi/1
{
  "suggest_field": {
    "input": ["Hotel Amsterdam" ],
    "context": {
      "loc": {
        "lat": 52.529172, 
        "lon": 13.407333
      }
    }
  }
}

GET venues/poi/2
PUT venues/poi/2
{
  "suggest_field": {
    "input": ["Hotel Berlin in AMS" ],
    "context": {
      "loc": {
        "lat": 52.363389, 
        "lon": 4.888695
      }
    }
  }
}

GET /venues/_search

GET /venues/_suggest
{
  "suggest" : {
    "text" : "h",
    "completion" : {
      "field" : "suggest_field",
      "context": {
        "loc": {
          "lat": 52.36,
          "lon": 4.88
        }
      }
    }
  }
}

This returns a parsing exception (but is mentioned in the docs like that)

DELETE venues
PUT venues

GET venues/_mapping
PUT venues/poi/_mapping
{
  "poi" : {
    "properties" : {
      "suggest_field": {
        "type": "completion",
        "context": {
          "location": {
              "type": "geo",
              "precision": ["1km", "5m"],
              "neighbors": true,
              "path": "pin",
              "default": {
                  "lat": 0.0,
                  "lon": 0.0
              }
          }
        }
      }
    }
  }
}

This is also directly from the docs, using the value field, results in a parse exception

DELETE venues
PUT venues

GET venues/_mapping
PUT venues/poi/_mapping
{
  "poi" : {
    "properties" : {
      "suggest_field": {
        "type": "completion",
        "context": {
          "loc": { 
            "type": "geo",
            "precision" : "10km"
          }
        }
      }
    }
  }
}

GET /venues/_suggest
{
    "suggest" : {
        "text" : "m",
        "completion" : {

            "field" : "suggest_field",
            "size": 10,
            "context": {
                "location": {
                    "value": {

                        "lat": 0,
                        "lon": 0
                    },
                    "precision": "1km"
                }
            }
        }

    }
}

Also the category suggester seems to have an issue, when you specify a path in the mapping for the context, but that path is not set on document indexing

DELETE services
PUT services
PUT services/service/_mapping
{
    "service": {
        "properties": {
            "suggest_field": {
                "type": "completion",
                "context": {
                    "color": { 
                        "type": "category",
                        "path": "color_field"
                    }
                }
            }
        }
    }
}

GET services/service/_mapping

PUT services/service/1
{
    "suggest_field": {
        "input": ["knacksack", "backpack", "daypack"]
    }
}

This was tested on the 1.x branch and master

s1monw added a commit that referenced this issue Mar 25, 2014

Revert "ContextSuggester"
Reverting context suggester due to #5525 The release of this
feature is delayed untile `v1.2`

This reverts commit 44f52e4.
This reverts commit 8c59210.

@spinscale spinscale self-assigned this Mar 25, 2014

@spinscale spinscale added the bug label Mar 27, 2014

@spinscale spinscale closed this in 0ff30ad Mar 31, 2014

spinscale added a commit that referenced this issue Mar 31, 2014

ContextSuggester: Adding couple of tests to catch more bugs
A bunch of minor fixes have been included here, especially due
to wrongly parsed mappings. Also using assertions resulted in an
NPE because they were disabled in the distribution.

Closes #5525

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015

Revert "ContextSuggester"
Reverting context suggester due to #5525 The release of this
feature is delayed untile `v1.2`

This reverts commit 44f52e4.
This reverts commit 8c59210.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment