Trying to build a faceted search that works like a charm, except for my locations_path


(georgi.mateev) #1

Hi guys,
I have been trying to build a faceted search and it works pretty well so
far. There is just one problem that I have been struggling with in the last
few days.

It is a multinational jobsearch and the jobs are categorized under a
country and a state. I want to be able to search for different states in
different countries (It could happen in the EU, where some people would be
interested to work abroad in a neighboring district).

So what I tried out was this tutorial
http://www.springyweb.com/2012/01/hierarchical-faceting-with-elastic.html .
I skipped the part with the new tokenizer, as I don't care about the number
of the level.

Unfortunately it didn't work. The fields seems to get tokenized, since when
I search for regexp "44" it finds /44/10, if I search for "10" it finds
/44/10, but if I search for "/44" or "44.*" I get 0 hits.

Then I removed the path_tokenizer and tried to work with a not_analyzed
string, hoping that it would do the job, but again it didn't work out.

What am I doing wrong? This is the mapping: The field is locations_path

{
"vacancy": {
"index_analyzer": "indexAnalyzer",
"search_analyzer": "searchAnalyzer",
"_boost": {
"name": "_boost",
"null_value": 1
},
"properties": {
"vId": {
"type": "integer",
"include_in_all": false
},
"title": {
"type": "string",
"include_in_all": true
},
"teaser": {
"type": "string",
"include_in_all": true
},
"keywords": {
"type": "multi_field",
"include_in_all": true
},
"completion": {
"type": "completion",
"analyzer": "standard"
},
"description": {
"type": "string",
"include_in_all": true
},
"company": {
"type": "multi_field",
"include_in_all": true
},
"company_id": {
"type": "multi_field",
"include_in_all": false
},
"workingSchedule": {
"type": "object",
"properties": {
"de": {
"type": "string",
"include_in_all": true
},
"ch": {
"type": "string",
"include_in_all": true
},
"pl": {
"type": "string",
"include_in_all": true
}
}
},
"careerPosition": {
"type": "object",
"properties": {
"de": {
"type": "string",
"include_in_all": true
},
"ch": {
"type": "string",
"include_in_all": true
},
"pl": {
"type": "string",
"include_in_all": true
}
}
},
"jobExperience": {
"type": "object",
"properties": {
"de": {
"type": "string",
"include_in_all": true
},
"ch": {
"type": "string",
"include_in_all": true
},
"pl": {
"type": "string",
"include_in_all": true
}
}
},
"seniority": {
"type": "object",
"properties": {
"de": {
"type": "string",
"include_in_all": true
},
"ch": {
"type": "string",
"include_in_all": true
},
"pl": {
"type": "string",
"include_in_all": true
}
}
},
"subjects": {
"type": "multi_field",
"include_in_all": false
},
"subjects_fulltext": {
"type": "object",
"properties": {
"de": {
"type": "multi_field",
"include_in_all": true
},
"ch": {
"type": "multi_field",
"include_in_all": true
},
"pl": {
"type": "multi_field",
"include_in_all": true
}
}
},
"locations_path": {
"type": "string",
"include_in_all": false,
"index": "not_analyzed"
},
"locations": {
"type": "multi_field",
"include_in_all": false
},
"locations_fulltext": {
"type": "multi_field",
"include_in_all": true
},
"categories": {
"type": "multi_field",
"include_in_all": false
},
"categories_fulltext": {
"type": "object",
"properties": {
"de": {
"type": "multi_field",
"include_in_all": true
},
"ch": {
"type": "multi_field",
"include_in_all": true
},
"pl": {
"type": "multi_field",
"include_in_all": true
}
}
},
"careerPosition_id": {
"type": "multi_field",
"include_in_all": false
},
"workingSchedule_id": {
"type": "multi_field",
"include_in_all": false
},
"jobExperience_id": {
"type": "multi_field",
"include_in_all": false
},
"seniority_id": {
"type": "multi_field",
"include_in_all": false
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bf626da9-3ff8-4f1e-9977-f29ba54429df%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(georgi.mateev) #2

Another strange thing that I see, is that if the field is mapped like a
"string", I am not able to find anything on it. Neither can I do facets. If
it is a multi_field, I get facets and results.

That's something that the documentation didn't say, that's why I think that
I have other errors in the setup. But the documentation doesn't say
anything on that topic as well, so I don't know what it is.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a736eb64-b513-496f-a892-7d3938f74bb9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(georgi.mateev) #3

There is a complete curl recreation in this gist:

https://gist.github.com/gmateev/8808650

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3d2c57fd-6b15-480e-bdbc-8ef210c564dc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4