Skip to content

Commit cf7cf7d

Browse files
committed
docs: add compat docs
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
1 parent fd86e0b commit cf7cf7d

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

README.compat.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Compat
2+
3+
## Mixed Elasticsearch Version Environments
4+
5+
### Compatibility Matrix
6+
7+
| Elasticsearch Gem | ES 7.x Server | ES 8.x Server | ES 9.x Server |
8+
|-------------------|---------------|---------------|---------------|
9+
| gem 7.17.x | ✅ Works | ✅ Works | ❌ No |
10+
| gem 8.15.x | ✅ Works | ✅ Works | ❌ No |
11+
| gem 9.1.x + patch | ✅ With config| ✅ With config| ✅ Works |
12+
13+
### Configuration Options
14+
15+
#### force_content_type
16+
17+
Type: String
18+
Default: nil (auto-detect)
19+
Valid values: "application/json", "application/x-ndjson"
20+
Manually override the Content-Type header. Required when using elasticsearch gem 9.x with ES 7.x or 8.x servers.
21+
22+
```ruby
23+
<match **>
24+
@type elasticsearch
25+
force_content_type application/json
26+
</match>
27+
```
28+
29+
#### ignore_version_content_type_mismatch
30+
31+
Type: Bool
32+
Default: false
33+
Automatically fallback to application/json if Content-Type version mismatch occurs. Enables seamless operation across mixed ES 7/8/9 environments.
34+
35+
Example:
36+
37+
```ruby
38+
<match **>
39+
@type elasticsearch
40+
force_content_type application/json
41+
ignore_version_content_type_mismath true
42+
</match>
43+
```
44+
45+
### Recommended Configuration
46+
47+
#### For ES 7/8 environments (Recommended)
48+
49+
Use elasticsearch gem 8.x - works with both versions, no configuration needed:
50+
51+
```ruby
52+
# Gemfile
53+
gem 'elasticsearch', '~> 8.15.0'
54+
55+
# fluent.conf
56+
<match **>
57+
@type elasticsearch
58+
hosts es7:9200,es8:9200
59+
# No special config needed!
60+
</match>
61+
```
62+
63+
#### For gem 9.x with ES 7/8 (Not recommended, but supported)
64+
65+
```ruby
66+
# Gemfile
67+
gem 'elasticsearch', '~> 9.1.0'
68+
69+
# fluent.conf
70+
<match **>
71+
@type elasticsearch
72+
hosts es7:9200,es8:9200
73+
74+
# REQUIRED: Force compatible content type
75+
force_content_type application/json
76+
</match>
77+
```

0 commit comments

Comments
 (0)