Confusion/problems working with facets for nested documents


(Rubish Gupta) #1

I am trying to implement faceted search for users.

Relevant part of mapping for users can be seen at
https://gist.github.com/1357430#file_mapping.json. Each user has some
personal_info, alma_info and many professional details. I want to filter
users based on name, course/branch(alma_info) and professional details.
Professions are nested documents in a user.

Sample document for the user can be seen at
https://gist.github.com/1357430#file_sample_document.json.

I have three use cases for facets on company names of users:

  1. Facet on all past and current(independently) company names of matched
    users in the query
  2. Facet on past and current company names matching a string(using
    edgeNGram) of matched users
  3. Facet on company names excluding documents matching certain names of
    matched users

Questions:

  1. Is it possible to filter on root documents and only get facets for
    nested types for the filtered root documents. Query I was trying to
    generate for this was https://gist.github.com/1357430#file_query1.curl.
    Data does have some professions with companies, but its showing missing for
    all.
  2. Is it possible to filter on root documents and only get facets for
    nested documents matching some more conditions. Query I was trying to
    generate for this was https://gist.github.com/1357430#file_query2.curl

I would appreciate any help I can get. Please let me know if I information
provided is not sufficient.


(Shay Banon) #2

Hey,

Yea, check the nested part described here:
http://www.elasticsearch.org/guide/reference/api/search/facets/ (at the
bottom).

-shay.banon

On Fri, Nov 11, 2011 at 10:27 AM, rubish gupta <rubish.gupta@almaconnect.com

wrote:

I am trying to implement faceted search for users.

Relevant part of mapping for users can be seen at
https://gist.github.com/1357430#file_mapping.json. Each user has some
personal_info, alma_info and many professional details. I want to filter
users based on name, course/branch(alma_info) and professional details.
Professions are nested documents in a user.

Sample document for the user can be seen at
https://gist.github.com/1357430#file_sample_document.json.

I have three use cases for facets on company names of users:

  1. Facet on all past and current(independently) company names of
    matched users in the query
  2. Facet on past and current company names matching a string(using
    edgeNGram) of matched users
  3. Facet on company names excluding documents matching certain names
    of matched users

Questions:

  1. Is it possible to filter on root documents and only get facets for
    nested types for the filtered root documents. Query I was trying to
    generate for this was https://gist.github.com/1357430#file_query1.curl.
    Data does have some professions with companies, but its showing missing for
    all.
  2. Is it possible to filter on root documents and only get facets for
    nested documents matching some more conditions. Query I was trying to
    generate for this was https://gist.github.com/1357430#file_query2.curl

I would appreciate any help I can get. Please let me know if I information
provided is not sufficient.


(Rubish Gupta) #3

Thanks for the link Shay.

I already visited that page earlier. I guess I was constructing the query
wrongly earlier. After making some changes to the query(making it pretty
minimalistic to start with) I am getting the exception,
ArrayIndexOutOfBound. I have replied to the thread and will try to come up
with a recreation.

On Sun, Nov 13, 2011 at 2:11 PM, Shay Banon kimchy@gmail.com wrote:

Hey,

Yea, check the nested part described here:
http://www.elasticsearch.org/guide/reference/api/search/facets/ (at the
bottom).

-shay.banon

On Fri, Nov 11, 2011 at 10:27 AM, rubish gupta <
rubish.gupta@almaconnect.com> wrote:

I am trying to implement faceted search for users.

Relevant part of mapping for users can be seen at
https://gist.github.com/1357430#file_mapping.json. Each user has some
personal_info, alma_info and many professional details. I want to filter
users based on name, course/branch(alma_info) and professional details.
Professions are nested documents in a user.

Sample document for the user can be seen at
https://gist.github.com/1357430#file_sample_document.json.

I have three use cases for facets on company names of users:

  1. Facet on all past and current(independently) company names of
    matched users in the query
  2. Facet on past and current company names matching a string(using
    edgeNGram) of matched users
  3. Facet on company names excluding documents matching certain names
    of matched users

Questions:

  1. Is it possible to filter on root documents and only get facets for
    nested types for the filtered root documents. Query I was trying to
    generate for this was https://gist.github.com/1357430#file_query1.curl.
    Data does have some professions with companies, but its showing missing for
    all.
  2. Is it possible to filter on root documents and only get facets for
    nested documents matching some more conditions. Query I was trying to
    generate for this was https://gist.github.com/1357430#file_query2.curl

I would appreciate any help I can get. Please let me know if I
information provided is not sufficient.


(system) #4