Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling Indexing of Users & Terms Maps Date/Time Fields as Strings #1817

Closed
dmhendricks opened this issue Jun 25, 2020 · 8 comments
Closed
Labels

Comments

@dmhendricks
Copy link

Describe the bug

If I activate indexing of Users and/or Terms, the schema for post_date and post_date_gmt is mapped as text rather than date. This presents a bit of an inconvenience when I try to work with the data in Kibana because it doesn't let me filter posts by date/time, nor add either field as the default Time Filter (since it only allows Date types for this functionality, though perhaps there is a way to get around it that I'm not aware of).

Steps to Reproduce

  1. wp elasticpress activate-feature users and/or wp elasticpress activate-feature terms
  2. wp elasticpress put-mapping / wp elasticpress index --setup
  3. When I view the data in Kibana, the post_date and post_date_gmt fields are now mapped as text types (?).

Expected behavior

It would be nice if they were mapped as Date (as they are when indexing of Users and/or Terms is disabled) so that I may filter the data accordingly in Kibana, et al.

Environment information

  • OS: Ubuntu 16.04 LTS (4 sites), Ubuntu 20.04+Docker latest (2 sites)
  • PHP: 7.0.33 (4 sites), 7.4.7 (2 sites)
  • ElasticPress: 3.4.2
  • Elasticsearch/Kibana: 7.5.2 (official Docker images)
  • WordPress version: 5.4.2
  • Site Health Info: I have this disabled on all of my sites for security/user annoyance reasons, but can enable it and provide the output if required/relevant.

Additional context

I had never enabled indexing of these before, but wanted to for speed, so I'm uncertain if it is a new thing or if it was always this way. It appears to be doing this on all of my sites (6 of them, each with different themes/plugins but all with the same versions noted above).

I currently have indexing of Users and Terms disabled on all of the sites because I rely on Kibana for working with data.

Thank you.

@brandwaffle
Copy link
Contributor

brandwaffle commented Jul 1, 2020

@dmhendricks thanks for reaching out! From what I can see, the mapping for post_date is 'date' already:

'post_date' => array(
'type' => 'date',
'format' => 'yyyy-MM-dd HH:mm:ss',
),
'post_date_gmt' => array(
'type' => 'date',
'format' => 'yyyy-MM-dd HH:mm:ss',

Can you share the error you're getting? I'm wondering if maybe the mapping isn't being properly applied and ES is guessing at some fields.

Also, I'd love to know what types of reporting you pull with Kibana. Since EP tracks mostly searches and not real-time data, I can never think of good use-cases for Kibana reporting but I know they're out there and we'd love to make the plugin work better for them.

@brandwaffle
Copy link
Contributor

@tlovett1 since you're most familiar with Users/Terms, any chance you could also take a quick look at this one?

@oscarssanchez
Copy link
Contributor

Hi @dmhendricks ,

Have you tried with the latest version of Elasticpress? We have been merging a lot of code and might be solving the issue. Please feel free to open a new issue if this is not resolved!

@victorpintot8
Copy link

Same error here, I'm using version 3.5.5. The mapping is always created using the test field type, instead of date. I debbuged the code, and althought is clearly defined in "7.-0.php" file line 293, for some reason ES ignore that mapping and sets text. Is very annoying, i can't use the autosuggest feature, it throws error 400 bad request "field [post_date_gmt] is of type [indexed,tokenized], but only numeric types are supported".

@balajidamodare
Copy link

facing the same issue on the latest version of the elasticpress [Version 4.1.0]

@balajidamodare
Copy link

balajidamodare commented May 25, 2022

simply I am indexing data via the command line and its mapping date field as text.
steps to reproduce

wp elasticpress clear-index
wp elasticpress delete-index --yes
wp elasticpress index --show-bulk-errors --post-type="videos, tech-101, news, interviews, guest-article, deep-dive, behind-the-scenes, ask-the-cxo, articles"

Not showing any errors on CLI

@felipeelia
Copy link
Member

wp elasticpress index --show-bulk-errors --post-type="videos, tech-101, news, interviews, guest-article, deep-dive, behind-the-scenes, ask-the-cxo, articles"

should actually be

wp elasticpress index --setup --yes --show-bulk-errors --post-type="videos, tech-101, news, interviews, guest-article, deep-dive, behind-the-scenes, ask-the-cxo, articles"

--setup will send the mapping again, as they are deleted by the delete-index command you are calling right before.

@balajidamodare
Copy link

balajidamodare commented May 26, 2022

Hi Flipeelia
Thank you for your reply I have tried and executed it, but the documents are not indexed and it shows the message as Success: Indexing posts....

followed following steps

command: wp elasticpress clear-index
Output : Success: Index cleared.
command: wp elasticpress delete-index --yes
Output : Success: Index deleted
Deleting index for posts...
command: wp elasticpress index --setup --yes --show-bulk-errors --post-type="videos, tech-101, news, interviews, guest-article, deep-dive, behind-the-scenes, ask-the-cxo, articles"
Output : Success: Indexing posts...

In Dashboard showing the following Message
We could not find any data for your Elasticsearch indices. Maybe you need to [sync your content]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants