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

Add versatile 'like' parameter #8039

Closed

Conversation

alexksikes
Copy link
Contributor

The MLT query has a lot of parameters. For example, a set of documents is
specified with either like_text, ids or docs, with at least one
parameter required. This commit groups all the document specification
parameters under one called like. The syntax is described below and could
easily be extended to allow for new means of specifying document input. The
like_text, ids and docs parameters are deprecated.

As a single piece text:

{
  "query": {
    "more_like_this": {
      "like": "some text here"
    }
  }
}

As a single item:

{
  "query": {
    "more_like_this": {
      "like": {
        "_index": "imdb",
        "_type": "movies",
        "_id": "88247"
      }
    }
  }
}

Or as a mixture of all:

{
  "query": {
    "more_like_this": {
      "like": [
        "Some random text ...",
        {
          "_index": "imdb",
          "_type": "movies",
          "_id": "88247"
        },
        {
          "_index": "imdb",
          "_type": "movies",
          "doc": {
            "title": "Document with an artificial title!"
          }
        }
      ]
    }
  }
}

@s1monw
Copy link
Contributor

s1monw commented Oct 9, 2014

I like this thsi looks much better! Can we maybe have some comments next to the parse fields which of them are deprecated?

@s1monw s1monw removed the review label Oct 9, 2014
@s1monw
Copy link
Contributor

s1monw commented Oct 13, 2014

LGTM - I wonder if we should wait with this a bit and refactor ParseField to support field names where all of them are deprecated. I'd love to be able to pass something like this:

ParseField LIKE_TEXT = new ParseField("like_text", true /* deprecated */, "like" /* the actual field to use instead */);

such that we can barf with the strict parse option? (note my example might not be the best way to implement it)

@s1monw s1monw removed the review label Oct 13, 2014
@alexksikes
Copy link
Contributor Author

OK I've just opened #8067

The MLT query has a lot of parameters. For example, a set of documents is
specified with either `like_text`, `ids` or `docs`, with at least one
parameter required. This commit groups all the document specification
parameters under one called `like`. The syntax is described below and could
easily be extended to allow for new means of specifying document input. The
`like_text`, `ids` and `docs` parameters are deprecated.

As a single piece text:

{
  "query": {
    "more_like_this": {
      "like": "some text here"
    }
  }
}

As a single item:

{
  "query": {
    "more_like_this": {
      "like": {
        "_index": "imdb",
        "_type": "movies",
        "_id": "88247"
      }
    }
  }
}

Or as a mixture of all:

{
  "query": {
    "more_like_this": {
      "like": [
        "Some random text ...",
        {
          "_index": "imdb",
          "_type": "movies",
          "_id": "88247"
        },
        {
          "_index": "imdb",
          "_type": "movies",
          "doc": {
            "title": "Document with an artificial title!"
          }
        }
      ]
    }
  }
}
@alexksikes alexksikes deleted the feature/mlt-versatile-like branch October 25, 2014 09:21
@alexksikes alexksikes removed the review label Oct 25, 2014
@clintongormley clintongormley changed the title MLT Query: versatile 'like' parameter Add versatile 'like' parameter Jun 7, 2015
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :More Like This labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants