2

We have dataIndex with two types: users and jobs.

users: {
    tags: ['a', 'b'],
    locations: ['NY', 'SF']
    experience: [
        {
            title: 'Software Engineer',
            company: 'abc'
        }
    ]
}

Job: {
    tags: ['a', 'b'],
    location: 'NY',
    title: 'Software Enginner'
}

For a given user we are tying to suggest users and jobs using more_like_this query

User suggestion works fine using below query where id is the userid.

"more_like_this": {
    "fields": ["tags", "locations"],
    "docs": [
      {
        "_index": "dataIndex",
        "_type": "users",
        "_id": id
      }
    ],
}

For jobs we want to query against both jobs and users index. Basically match jobs same as user locations and tags. Is it possible with more_like_this query?

3
  • I will wait for answers before i make an answer myself but for now seems like if i have users and jobs in the same index and different types, i can use the same more_like_this query as i used for users. We need to make sure that both these types have the same fields. Commented Feb 18, 2015 at 21:39
  • Did you get anywhere with this? I'm having the same problem. Commented Mar 16, 2015 at 11:11
  • 1
    @ali You can create multiple types within the same index and then you can search across multiple types. Commented Mar 16, 2015 at 15:28

1 Answer 1

1

Yes it is. Just don't specify the type... e.g.

GET index_name/_search
{
  "query": {
    "more_like_this": {
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.