Skip to content
Permalink
Browse files

switching to wildcard query

fixes #6
  • Loading branch information
garbas committed May 8, 2020
1 parent 9064063 commit 68df617ec69714d877e3e69a177fa246b6196d36
Showing with 31 additions and 5 deletions.
  1. +31 −5 src/ElasticSearch.elm
@@ -244,12 +244,38 @@ makeRequestBody field query =
objectIn name object =
[ ( name, Json.Encode.object object ) ]
in
-- I'm not sure we need fuziness
--, ( "fuzziness", Json.Encode.int 1 )
query
|> stringIn "query"
-- Prefix Query
-- {
-- "query": {
-- "prefix": {
-- "user": {
-- "value": ""
-- }
-- }
-- }
-- }
--query
-- |> stringIn "value"
-- |> objectIn field
-- |> objectIn "prefix"
-- |> objectIn "query"
-- |> Json.Encode.object
-- |> Http.jsonBody
--
-- Wildcard Query
-- {
-- "query": {
-- "wildcard": {
-- "<field>": {
-- "value": "*<value>*",
-- }
-- }
-- }
-- }
("*" ++ query ++ "*")
|> stringIn "value"
|> objectIn field
|> objectIn "match"
|> objectIn "wildcard"
|> objectIn "query"
|> Json.Encode.object
|> Http.jsonBody

0 comments on commit 68df617

Please sign in to comment.
You can’t perform that action at this time.