Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
switching to wildcard query
fixes #6
  • Loading branch information
garbas committed May 8, 2020
1 parent 9064063 commit 68df617
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions src/ElasticSearch.elm
Expand Up @@ -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
Expand Down

0 comments on commit 68df617

Please sign in to comment.