I tried to google and read elasticsearch.org before. But due to my
lack of previous background in Lucene, etc, I find it tough to grasp
idea of mapping and analyzer in elasticsearch.
My documents schema is something like this:
"a": ["astr1", "astr2", "astr3", ...],
"substring_search_me": "hello world",
"c": ["cstr1", "cstr2", ...],
"description": "A potentially large string here ...",
"class1": "description for class1",
"class2": "description for class2",
"modified": 1234567 // An integer value (unix timestamp)
I want to:
- Query by typing in some free text, which should match text in any
of the fields (including inside the string arrays), except for field:
- I also want to search "keys" in b.class field, i.e., "class1",
"class2",... should also match search result (key names, and also
- Filter the result by modified date
- A match within field "name" should have rank higher, then say
inside any string in array "c"
- The field "substring_search_me" should allow arbitrary substring
matching inside it's content. For example, in content above, a string
"ello" should match the field
- I want to get all unique string in "c" (across all search results),
i.e., facets for "c" along with their counts (in the search output).
Can someone suggest me mapping, analyzer and kind of queries I require
for this task.
From my constrained understanding I think, I need an NGram analyzer
for allowing substring matching (is that correct?) .. How do I remove
field "substring_search_me" from index (apart from removing it while
adding document to elasticsearch itself ?).
Also how do I allow string matching for "key" names as well (but only
inside b.class hash, and not any other key name) ? For example in
above: "class1" should match the document (since it is inside b.class
hash), but "name" should not match (since it is not inside b.class
hash). How do I specify such a mapping ?
How do I stop content of "modified" field from being searched using
text searching, but still be able to filter on it's value based on
range of dates etc ?
Thanks a ton for your help in advance!