I have an index with data in several nested fields, that I want to build a small search engine for. Below I have my query, data example, and mapping.
I'm using highlight to display my result
If I search for "known existing phrase" I will get a search result that contains some of the words. The default_operator is OR, so that makes sense.
If I search for ""known existing phrase"", I would expect I would get this exact known existing phrase that I know is in my data, I get no hits.
If I set the default_operator to AND I also get no results
I can't figure out if it is
- my query that is wrong
- if it is highlight causing problems
- if it is searching in different nested fields that is the issue
- if I need an extra function like inner_hits
Any advice would be helpful
My query (from kibana)
GET graph_dummy_data/_search { "query": { "query_string": { "query": "known existing phrase", "fields": [ "graph_title", "graph_description" , "simulationer.title" , "simulationer.description" , "simulationer.trace.description", "simulationer.trace.label" , "simulationer.trace.guide", "simulationer.trace.purpose"], } }, "highlight": { "fields": { "graph_title": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]}, "graph_description": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]}, "simulationer.title": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]}, "simulationer.description": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]}, "simulationer.trace.description": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]}, "simulationer.trace.label": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]}, "simulationer.trace.guide": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]}, "simulationer.trace.purpose": {"pre_tags": ["<mark>"], "post_tags": ["</mark>"]} } } }
My data
"_index" : "Graph dummy data", "_type" : "_doc", "_id" : "14660", "_score" : 1.0, "_source" : { "graph_description" : "Graph description, encoded as tekst and should be searchable", "response" : "OK", "graph_id" : "14660", "@timestamp" : "2020-01-31T10:04:05.034Z", "graph_majortimestamp" : "2020-01-17T08:59:12.0000000Z", "graph_title" : "Graph title, encoded as tekst and should be searchable", "@version" : "1", "simulationer" : [ { "created" : "2020-01-13T11:16:18.8930000Z", "title" : "Simulationer title, encoded as tekst and should be searchable", "id" : "195213", "trace" : [ { "guide" : "", "role" : "Role 1, not searchable", "purpose" : "Activity purpose, encoded as tekst and should be searchable", "id" : "Activity3_1", "label" : "Activity label, encoded as tekst and should be searchable", "description" : "Activity description, encoded as tekst and should be searchable" }, { "guide" : "", "role" : "Role 1, not searchable", "purpose" : "Activity purpose, encoded as tekst and should be searchable", "id" : "Activity5", "label" : "Activity label, encoded as tekst and should be searchable", "description" : "Activity description, encoded as tekst and should be searchable" }, { "guide" : "", "role" : "Role 1, not searchable", "purpose" : "Activity purpose, encoded as tekst and should be searchable", "id" : "Activity22_1", "label" : "Activity label, encoded as tekst and should be searchable", "description" : "Activity description, encoded as tekst and should be searchable" }, { "guide" : "", "role" : "Role 1, not searchable", "purpose" : "Activity purpose, encoded as tekst and should be searchable", "id" : "Activity33", "label" : "Activity label, encoded as tekst and should be searchable", "description" : "Activity description, encoded as tekst and should be searchable" } ], "description" : Simulation description, encoded as tekst and should be searchable" },
My data's mapping
"mappings" : {
"properties" : {
"@timestamp" : {
"type" : "date"
},
"@version" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"graph_category" : {
"type" : "text"
},
"graph_description" : {
"type" : "text",
"analyzer" : "danish"
},
"graph_id" : {
"type" : "integer"
},
"graph_majortimestamp" : {
"type" : "date"
},
"graph_title" : {
"type" : "text",
"analyzer" : "danish"
},
"response" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"simulationer" : {
"type" : "nested",
"properties" : {
"created" : {
"type" : "date"
},
"description" : {
"type" : "text",
"analyzer" : "danish"
},
"id" : {
"type" : "integer"
},
"simulation_roles" : {
"type" : "text"
},
"title" : {
"type" : "text",
"analyzer" : "danish"
},
"trace" : {
"type" : "nested",
"properties" : {
"description" : {
"type" : "text",
"analyzer" : "danish"
},
"guide" : {
"type" : "text",
"analyzer" : "danish"
},
"id" : {
"type" : "text"
},
"label" : {
"type" : "text",
"analyzer" : "danish"
},
"purpose" : {
"type" : "text",
"analyzer" : "danish"
},
"role" : {
"type" : "text"
}
}
}
}
},
"type" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
}
}