ropensci / elastic

R client for the Elasticsearch HTTP API
https://docs.ropensci.org/elastic
Other
245 stars 58 forks source link

Has there been a change to behaviour of fuzzy match? #219

Closed cranknasty closed 6 years ago

cranknasty commented 6 years ago

HI, I've been running some fuzzy searches using this package for about 6 months now and everything has been running okay until about 2 weeks ago.

My fuzzy searches have started returning 0 results. I can do a standard search using Search(a,b, q = 'something') and get plenty of results... but the fuzzy match is empty. Please help... Has anything changed in the package recently that could cause this change in behaviour?

Here's an example of the fuzzy search:

fuzz <- list(query = list(fuzzy = list( = "something aruther"))) Search(index = , type = , body = fuzz)

here's the standard search

Search(index = , type = , q = ": something aruther")

Session Info ```r > devtools::session_info() Session info ----------------------------------------------------------------------------------------------------------------------------- setting value version R version 3.4.2 (2017-09-28) system x86_64, linux-gnu ui RStudio (1.1.383) language (EN) collate en_US.UTF-8 tz Zulu date 2018-04-10 Packages --------------------------------------------------------------------------------------------------------------------------------- package * version date source assertthat 0.2.0 2017-04-11 CRAN (R 3.4.2) base * 3.4.2 2017-09-29 local bindr 0.1 2016-11-13 CRAN (R 3.4.2) bindrcpp * 0.2 2017-06-17 CRAN (R 3.4.2) bitops 1.0-6 2013-08-17 CRAN (R 3.4.2) broom 0.4.3 2017-11-20 CRAN (R 3.4.2) cellranger 1.1.0 2016-07-27 CRAN (R 3.4.2) chron 2.3-52 2018-01-06 CRAN (R 3.4.2) cli 1.0.0 2017-11-05 CRAN (R 3.4.2) codetools 0.2-15 2016-10-05 CRAN (R 3.3.1) colorspace 1.3-2 2016-12-14 CRAN (R 3.4.2) compiler 3.4.2 2017-09-29 local crayon 1.3.4 2017-09-16 CRAN (R 3.4.2) cronR 0.4.0 2018-03-09 CRAN (R 3.4.2) curl 3.0 2017-10-06 CRAN (R 3.4.2) data.table * 1.10.4-3 2017-10-27 CRAN (R 3.4.2) datasets * 3.4.2 2017-09-29 local DBI * 0.7 2017-06-18 CRAN (R 3.4.2) devtools 1.13.3 2017-08-02 CRAN (R 3.4.2) digest 0.6.12 2017-01-27 CRAN (R 3.4.2) doParallel * 1.0.11 2017-09-28 CRAN (R 3.4.2) dplyr * 0.7.4 2017-09-28 CRAN (R 3.4.2) elastic * 0.8.0 2017-09-14 CRAN (R 3.4.2) forcats * 0.3.0 2018-02-19 CRAN (R 3.4.2) foreach * 1.4.3 2015-10-13 CRAN (R 3.4.2) foreign 0.8-69 2017-06-21 CRAN (R 3.4.0) geosphere * 1.5-7 2017-11-05 CRAN (R 3.4.2) ggplot2 * 2.2.1 2016-12-30 CRAN (R 3.4.2) glue 1.2.0 2017-10-29 CRAN (R 3.4.2) googlesheets * 0.2.2 2017-05-07 CRAN (R 3.4.2) graphics * 3.4.2 2017-09-29 local grDevices * 3.4.2 2017-09-29 local grid 3.4.2 2017-09-29 local gtable 0.2.0 2016-02-26 CRAN (R 3.4.2) haven 1.1.1 2018-01-18 CRAN (R 3.4.2) hms 0.3 2016-11-22 CRAN (R 3.4.2) htmltools 0.3.6 2017-04-28 CRAN (R 3.4.2) httpuv * 1.3.5 2017-07-04 CRAN (R 3.4.2) httr * 1.3.1 2017-08-20 CRAN (R 3.4.2) iterators * 1.0.8 2015-10-13 CRAN (R 3.4.2) jsonlite * 1.5 2017-06-01 CRAN (R 3.4.2) lattice 0.20-35 2017-03-25 CRAN (R 3.3.3) lazyeval 0.2.0 2016-06-12 CRAN (R 3.4.2) lubridate 1.7.2 2018-02-06 CRAN (R 3.4.2) magrittr * 1.5 2014-11-22 CRAN (R 3.4.2) memoise 1.1.0 2017-04-21 CRAN (R 3.4.2) methods * 3.4.2 2017-09-29 local mime 0.5 2016-07-07 CRAN (R 3.4.2) miniUI 0.1.1 2016-01-15 CRAN (R 3.4.2) mnormt 1.5-5 2016-10-15 CRAN (R 3.4.2) modelr 0.1.1 2017-07-24 CRAN (R 3.4.2) munsell 0.4.3 2016-02-13 CRAN (R 3.4.2) nlme 3.1-131 2017-02-06 CRAN (R 3.4.0) parallel * 3.4.2 2017-09-29 local pillar 1.1.0 2018-01-14 CRAN (R 3.4.2) pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.2) plyr 1.8.4 2016-06-08 CRAN (R 3.4.2) psych 1.7.8 2017-09-09 CRAN (R 3.4.2) purrr * 0.2.4 2017-10-18 CRAN (R 3.4.2) qdapTools * 1.3.3 2017-06-20 CRAN (R 3.4.2) R6 2.2.2 2017-06-17 CRAN (R 3.4.2) Rcpp 0.12.13 2017-09-28 CRAN (R 3.4.2) RCurl 1.95-4.10 2018-01-04 CRAN (R 3.4.2) readr * 1.1.1 2017-05-16 CRAN (R 3.4.2) readxl 1.0.0 2017-04-18 CRAN (R 3.4.2) reshape2 1.4.2 2016-10-22 CRAN (R 3.4.2) rgdal 1.2-16 2017-11-21 CRAN (R 3.4.2) rJava * 0.9-9 2017-10-12 CRAN (R 3.4.2) RJDBC * 0.2-7 2018-01-24 CRAN (R 3.4.2) rjson * 0.2.15 2014-11-03 CRAN (R 3.4.2) RJSONIO 1.3-0 2014-07-28 CRAN (R 3.4.2) rlang 0.1.6 2017-12-21 CRAN (R 3.4.2) RPostgreSQL * 0.6-2 2017-06-24 CRAN (R 3.4.2) rstudioapi 0.7 2017-09-07 CRAN (R 3.4.2) rvest 0.3.2 2016-06-17 CRAN (R 3.4.2) scales 0.5.0 2017-08-24 CRAN (R 3.4.2) shiny * 1.0.5 2017-08-23 CRAN (R 3.4.2) shinyFiles 0.6.2 2016-08-28 CRAN (R 3.4.2) slackr * 1.4.2 2016-07-20 CRAN (R 3.4.2) sp * 1.2-5 2017-06-29 CRAN (R 3.4.2) stats * 3.4.2 2017-09-29 local stringi 1.1.5 2017-04-07 CRAN (R 3.4.2) stringr * 1.2.0 2017-02-18 CRAN (R 3.4.2) tibble * 1.4.2 2018-01-22 CRAN (R 3.4.2) tidyr * 0.7.2 2017-10-16 CRAN (R 3.4.2) tidyselect 0.2.3 2017-11-06 CRAN (R 3.4.2) tidyverse * 1.2.1 2017-11-14 CRAN (R 3.4.2) tools 3.4.2 2017-09-29 local utils * 3.4.2 2017-09-29 local withr 2.0.0 2017-07-28 CRAN (R 3.4.2) xml2 1.1.1 2017-01-24 CRAN (R 3.4.2) xtable 1.8-2 2016-02-05 CRAN (R 3.4.2) yaml 2.1.14 2016-11-12 CRAN (R 3.4.2) ```
sckott commented 6 years ago

Your session info shows your using elastic from CRAN https://cran.rstudio.com/web/packages/elastic/ which hasn't been updated since last September, so I don't think it's a change in this pkg. Did you change your Elasticsearch version?

cranknasty commented 6 years ago

Thanks for the response. No there's been no update to our elastic server either. confounding.

sckott commented 6 years ago

using current version of elastic (install with remotes::install_github("ropensci/elastic")) on master, a fuzzy search works for me on one of the example datasets, running ES ver. v6.2.3. Does this work for you?

library(elastic)
shakespeare <- system.file("examples", "shakespeare_data_.json", package = "elastic")
invisible(docs_bulk(shakespeare))
fuzzy <- list(query = list(fuzzy = list(text_entry = list(value = "arms", fuzziness = 0))))
Search(index="shakespeare", body=fuzzy)$hits$total
#> [1] 37
fuzzy <- list(query = list(fuzzy = list(text_entry = list(value = "arms", fuzziness = 1))))
Search(index="shakespeare", body=fuzzy)$hits$total
#> [1] 49
fuzzy <- list(query = list(fuzzy = list(text_entry = list(value = "arms", fuzziness = 2))))
Search(index="shakespeare", body=fuzzy)$hits$total
#> [1] 617